| 318 | } |
| 319 | |
| 320 | void RnApp::UpdateUI() { |
| 321 | auto stat = GrStatistics::Instance(); |
| 322 | |
| 323 | // column 1 |
| 324 | lbl_app_running_time_->setText(NumFormatter::FormatTime(stat->app_running_time*1000).c_str()); |
| 325 | lbl_send_media_bytes_->setText(NumFormatter::FormatStorageSize(stat->server_send_media_bytes).c_str()); |
| 326 | lbl_send_media_speed_->setText(NumFormatter::FormatSpeed(stat->send_speed_bytes).c_str()); |
| 327 | |
| 328 | // column 2 |
| 329 | lbl_connected_clients_->setText(std::to_string(stat->connected_clients_).c_str()); |
| 330 | lbl_video_capture_type_->setText(stat->video_capture_type_.Clone().c_str()); |
| 331 | lbl_video_encode_type_->setText(stat->video_encode_type_.Clone().c_str()); |
| 332 | |
| 333 | // column 3 |
| 334 | lbl_relay_connected_->setText(stat->relay_connected_ ? "Online" : "Offline"); |
| 335 | lbl_audio_capture_type_->setText(stat->audio_capture_type_.Clone().c_str()); |
| 336 | lbl_audio_encode_type_->setText("OPUS"); |
| 337 | |
| 338 | // for (const auto& cp : frame_info_items_) { |
| 339 | // cp->ClearInfo(); |
| 340 | // } |
| 341 | int index = 0; |
| 342 | auto captures_info = stat->GetCapturesInfo(); |
| 343 | for (const auto& info : captures_info) { |
| 344 | if (index >= 4) { |
| 345 | break; |
| 346 | } |
| 347 | stat_charts_[index]->UpdateTitle(info->target_name().c_str()); |
| 348 | frame_info_items_[index]->UpdateInfo(info); |
| 349 | |
| 350 | std::map<QString, std::vector<int32_t>> stat_value; |
| 351 | // update video frame gap |
| 352 | auto video_capture_gaps = stat->GetVideoCaptureGaps(); |
| 353 | if (video_capture_gaps.contains(info->target_name())) { |
| 354 | stat_value.insert({kChartVideoFrameGap, video_capture_gaps[info->target_name()]}); |
| 355 | } |
| 356 | |
| 357 | // update encode durations |
| 358 | auto encode_durations = stat->GetEncodeDurations(); |
| 359 | if (encode_durations.contains(info->target_name())) { |
| 360 | stat_value.insert({kChartEncode, encode_durations[info->target_name()]}); |
| 361 | } |
| 362 | |
| 363 | // copy / resize texture |
| 364 | auto copy_texture_durations = stat->GetCopyTextureDurations(); |
| 365 | if (copy_texture_durations.contains(info->target_name())) { |
| 366 | stat_value.insert({kChartCopyTexture, copy_texture_durations[info->target_name()]}); |
| 367 | } |
| 368 | |
| 369 | auto map_cvt_texture_durations = stat->GetMapCvtTextureDurations(); |
| 370 | if (map_cvt_texture_durations.contains(info->target_name())) { |
| 371 | stat_value.insert({kChartMapCvtTexture, map_cvt_texture_durations[info->target_name()]}); |
| 372 | } |
| 373 | |
| 374 | if (index == 0) { |
| 375 | // update audio frame gap |
| 376 | auto audio_frame_gaps = stat->GetAudioFrameGaps(); |
| 377 | stat_value.insert({kChartAudioFrameGap, audio_frame_gaps}); |
no test coverage detected