| 640 | } |
| 641 | |
| 642 | void RdApplication::SendConfigurationBack() { |
| 643 | { |
| 644 | std::lock_guard<std::mutex> lk(capture_plugin_mtx_); |
| 645 | if (!capture_plugin_) { |
| 646 | LOGE("SendConfigurationBack failed, working monitor capture plugin is null."); |
| 647 | return; |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | tc::Message m; |
| 652 | m.set_type(tc::kServerConfiguration); |
| 653 | auto config = m.mutable_config(); |
| 654 | // screen info |
| 655 | auto monitors_info = config->mutable_monitors_info(); |
| 656 | auto capturing_name = [this]() { |
| 657 | std::lock_guard<std::mutex> lk(capture_plugin_mtx_); |
| 658 | return capture_plugin_->GetCapturingMonitorName(); |
| 659 | }(); |
| 660 | std::vector<CaptureMonitorInfo> monitors = [this]() { |
| 661 | std::lock_guard<std::mutex> lk(capture_plugin_mtx_); |
| 662 | return capture_plugin_->GetCaptureMonitorInfo(); |
| 663 | }(); |
| 664 | |
| 665 | LOGI("Will send configuration back, monitor size: {}", monitors.size()); |
| 666 | for (int i = 0; i < monitors.size(); i++) { |
| 667 | auto monitor = monitors[i]; |
| 668 | MonitorInfo info; |
| 669 | info.set_name(monitor.name_); |
| 670 | for (const auto& res : monitor.supported_res_) { |
| 671 | MonitorResolution mr; |
| 672 | mr.set_width(res.width_); |
| 673 | mr.set_height(res.height_); |
| 674 | info.mutable_resolutions()->Add(std::move(mr)); |
| 675 | } |
| 676 | info.set_current_width(monitor.Width()); |
| 677 | info.set_current_height(monitor.Height()); |
| 678 | monitors_info->Add(std::move(info)); |
| 679 | } |
| 680 | LOGI("Will send configuration back, fps: {}", settings_->encoder_.fps_); |
| 681 | config->set_fps(settings_->encoder_.fps_); |
| 682 | config->set_capturing_monitor_name(capturing_name); |
| 683 | config->set_file_transfer_enabled(settings_->file_transfer_enabled_); |
| 684 | config->set_audio_enabled(settings_->audio_enabled_); |
| 685 | config->set_can_be_operated(settings_->can_be_operated_); |
| 686 | // |
| 687 | auto buffer = ProtoAsData(&m); |
| 688 | PostNetMessage(buffer); |
| 689 | } |
| 690 | |
| 691 | void RdApplication::RequestRestartMe() { |
| 692 | tcrp::RpMessage m; |
no test coverage detected