@@ -66,6 +66,10 @@ EgressLinkConnectionWidget::EgressLinkConnectionWidget(
6666 output, SIGNAL (recordingStatusChanged (RecordingOutputStatus)), this ,
6767 SLOT (onRecordingStatusChanged (RecordingOutputStatus))
6868 );
69+ connect (
70+ output, SIGNAL (statisticsUpdated (double , int , int , uint64_t )), this ,
71+ SLOT (onStatisticsUpdated (double , int , int , uint64_t ))
72+ );
6973 connect (ui->settingsButton , SIGNAL (clicked ()), this , SLOT (onSettingsButtonClick ()));
7074 connect (ui->visibilityCheckBox , SIGNAL (clicked (bool )), this , SLOT (onVisibilityChanged (bool )));
7175 connect (ui->videoSourceComboBox , SIGNAL (currentIndexChanged (int )), this , SLOT (onVideoSourceChanged (int )));
@@ -78,6 +82,8 @@ EgressLinkConnectionWidget::EgressLinkConnectionWidget(
7882 // Translations
7983 ui->videoSourceLabel ->setText (QTStr (" LocalSource" ));
8084 ui->statusLabel ->setText (QTStr (" Status" ));
85+ ui->statsLabel ->setText (QTStr (" Statistics" ));
86+ ui->statsValueLabel ->setText (" " );
8187
8288 obs_log (LOG_DEBUG, " EgressLinkConnectionWidget created" );
8389}
@@ -130,38 +136,45 @@ void EgressLinkConnectionWidget::onOutputStatusChanged(EgressLinkOutputStatus st
130136 case EGRESS_LINK_OUTPUT_STATUS_ACTIVATING:
131137 ui->statusValueLabel ->setText (QTStr (" Activating" ));
132138 ui->statusIconLabel ->setVisible (true );
139+ ui->statsWidget ->setVisible (false );
133140 setThemeID (ui->statusValueLabel , " good" , " text-success" );
134141 break ;
135142 case EGRESS_LINK_OUTPUT_STATUS_ACTIVE:
136143 ui->statusValueLabel ->setText (QTStr (" Active" ));
137144 ui->statusIconLabel ->setVisible (true );
145+ ui->statsWidget ->setVisible (true );
138146 setThemeID (ui->statusValueLabel , " good" , " text-success" );
139147 break ;
140148 case EGRESS_LINK_OUTPUT_STATUS_STAND_BY:
141149 ui->statusValueLabel ->setText (QTStr (" StandBy" ));
142150 ui->statusIconLabel ->setVisible (false );
151+ ui->statsWidget ->setVisible (false );
143152 setThemeID (ui->statusValueLabel , " good" , " text-success" );
144153 break ;
145154 case EGRESS_LINK_OUTPUT_STATUS_ERROR:
146155 ui->statusValueLabel ->setText (QTStr (" Error" ));
147156 ui->statusIconLabel ->setVisible (false );
157+ ui->statsWidget ->setVisible (false );
148158 setThemeID (ui->statusValueLabel , " error" , " text-danger" );
149159 // Try to remove error sources from combo
150160 updateSourceList ();
151161 break ;
152162 case EGRESS_LINK_OUTPUT_STATUS_INACTIVE:
153163 ui->statusValueLabel ->setText (QTStr (" Inactive" ));
154164 ui->statusIconLabel ->setVisible (false );
165+ ui->statsWidget ->setVisible (false );
155166 setThemeID (ui->statusValueLabel , " " , " " );
156167 break ;
157168 case EGRESS_LINK_OUTPUT_STATUS_DISABLED:
158169 ui->statusValueLabel ->setText (QTStr (" Disabled" ));
159170 ui->statusIconLabel ->setVisible (false );
171+ ui->statsWidget ->setVisible (false );
160172 setThemeID (ui->statusValueLabel , " " , " " );
161173 break ;
162174 case EGRESS_LINK_OUTPUT_STATUS_RECONNECTING:
163175 ui->statusValueLabel ->setText (QTStr (" Reconnecting" ));
164176 ui->statusIconLabel ->setVisible (false );
177+ ui->statsWidget ->setVisible (false );
165178 setThemeID (ui->statusValueLabel , " error" , " text-danger" );
166179 break ;
167180 }
@@ -247,3 +260,13 @@ void EgressLinkConnectionWidget::onVisibilityChanged(bool value)
247260{
248261 output->setVisible (value);
249262}
263+
264+ void EgressLinkConnectionWidget::onStatisticsUpdated (double bitrate, int totalFrames, int droppedFrames, uint64_t )
265+ {
266+ ui->statsValueLabel ->setText (
267+ QTStr (" %1.kbps[drops.%2(%3%)]" )
268+ .arg (bitrate, 0 , ' f' , 0 )
269+ .arg (droppedFrames)
270+ .arg (totalFrames ? 100.0 * (double )droppedFrames / (double )totalFrames : 0.0 , 0 , ' f' , 1 )
271+ );
272+ }
0 commit comments