MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / StartProcessWithScreenCapture

Method StartProcessWithScreenCapture

src/render/rd_app.cpp:514–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512 }
513
514 void RdApplication::StartProcessWithScreenCapture() {
515 msg_listener_->Listen<CaptureVideoFrame>([=, this](const CaptureVideoFrame& msg) {
516 // todo: RtcLocal process
517 //
518
519 if (!HasConnectedPeer()) {
520 return;
521 }
522 bool only_audio_clients = true;
523 plugin_manager_->VisitNetPlugins([&](GrNetPlugin* plugin) {
524 if (plugin->IsWorking() && !plugin->IsOnlyAudioClients()) {
525 only_audio_clients = false;
526 }
527 });
528 if (only_audio_clients) {
529 LOGI("Only audio clients, ignore video frame.");
530 return;
531 }
532
533 // calculate gaps between 2 captured frames.
534 //{
535 // auto current_time = TimeUtil::GetCurrentTimestamp();
536 // if (last_capture_screen_time_ == 0) {
537 // last_capture_screen_time_ = current_time;
538 // }
539 // auto gap = current_time - last_capture_screen_time_;
540 // last_capture_screen_time_ = current_time;
541 // statistics_->AppendFrameGap(gap);
542 //}
543
544 // to encode
545 encoder_thread_->Encode(msg);
546 });
547
548 msg_listener_->Listen<CaptureCursorBitmap>([=, this](const CaptureCursorBitmap& cursor_msg) {
549 auto net_msg = NetMessageMaker::MakeCursorInfoSyncMsg(cursor_msg.x_, cursor_msg.y_, cursor_msg.hotspot_x_,
550 cursor_msg.hotspot_y_, cursor_msg.width_, cursor_msg.height_,
551 cursor_msg.visible_, cursor_msg.data_, cursor_msg.type_);
552 PostNetMessage(net_msg);
553 });
554
555 if (capture_plugin_) {
556 LOGI("Will start capturing by using: {}", capture_plugin_->GetPluginName());
557 auto r = capture_plugin_->StartCapturing();
558 if (!r) {
559 LOGE("StartCapturing failed in : {}", capture_plugin_->GetPluginName());
560 if (capture_plugin_->GetPluginId() == kDdaCapturePluginId) {
561 LOGW("The failed capture is DDA, will change to GDI");
562 if (SwitchGdiCapture()) {
563 capture_plugin_->StartCapturing();
564 }
565 }
566 }
567 }
568 if (data_provider_plugin) {
569 data_provider_plugin->StartProviding();
570 }
571 app_manager_->StartProcess();

Callers

nothing calls this directly

Calls 9

VisitNetPluginsMethod · 0.80
StartCapturingMethod · 0.80
IsWorkingMethod · 0.45
IsOnlyAudioClientsMethod · 0.45
EncodeMethod · 0.45
GetPluginNameMethod · 0.45
GetPluginIdMethod · 0.45
StartProvidingMethod · 0.45
StartProcessMethod · 0.45

Tested by

no test coverage detected