File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
webrtc-jni/src/main/cpp/src/media/video Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2323#include " modules/desktop_capture/desktop_capture_options.h"
2424#include " modules/video_capture/video_capture_factory.h"
2525#include " third_party/libyuv/include/libyuv/video_common.h"
26+ #include " rtc_base/logging.h"
2627#include " system_wrappers/include/sleep.h"
2728
2829#include " modules/desktop_capture/desktop_capturer.h"
@@ -106,6 +107,16 @@ namespace jni
106107 void VideoTrackDesktopSource::OnCaptureResult (webrtc::DesktopCapturer::Result result, std::unique_ptr<webrtc::DesktopFrame> frame)
107108 {
108109 if (result != webrtc::DesktopCapturer::Result::SUCCESS) {
110+ if (result == webrtc::DesktopCapturer::Result::ERROR_PERMANENT) {
111+ RTC_LOG (LS_ERROR) << " Permanent error capturing desktop frame. Stopping track." ;
112+
113+ // Notify the track that we are permanently done.
114+ sourceState = kEnded ;
115+ FireOnChanged ();
116+
117+ stop ();
118+ }
119+
109120 return ;
110121 }
111122
@@ -261,7 +272,5 @@ namespace jni
261272
262273 webrtc::SleepMs (msPerFrame);
263274 }
264-
265- sourceState = kEnded ;
266275 }
267276}
You can’t perform that action at this time.
0 commit comments