File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class FlutterFrameCapturer
27
27
std::string path_;
28
28
std::mutex mutex_;
29
29
scoped_refptr<RTCVideoFrame> frame_;
30
+ volatile bool catch_frame_;
30
31
31
32
bool SaveFrame ();
32
33
};
Original file line number Diff line number Diff line change @@ -21,14 +21,21 @@ void FlutterFrameCapturer::OnFrame(scoped_refptr<RTCVideoFrame> frame) {
21
21
}
22
22
23
23
frame_ = frame.get ()->Copy ();
24
- mutex_. unlock () ;
24
+ catch_frame_ = true ;
25
25
}
26
26
27
27
void FlutterFrameCapturer::CaptureFrame (
8000
28
28
std::unique_ptr<MethodResultProxy> result) {
29
29
mutex_.lock ();
30
+ // Here init catch_frame_ flag
31
+ catch_frame_ = false ;
32
+
30
33
track_->AddRenderer (this );
31
- // Here the OnFrame method has to unlock the mutex
34
+ // Here waiting for catch_frame_ is set to true
35
+ while (!catch_frame_){}
36
+ // Here unlock the mutex
37
+ mutex_.unlock ();
38
+
32
39
mutex_.lock ();
33
40
track_->RemoveRenderer (this );
34
41
You can’t perform that action at this time.
0 commit comments