Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: webrtc/api/java/jni/androidvideocapturer_jni.cc

Issue 1987663002: android: Don't do a thread jump for incoming frames. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete VideoBroadcaster thread checker Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/jni/androidvideocapturer_jni.cc
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc
index 615fcb32d80c30895e4958215e96be5ef5ed9dda..5acd3dc087d8a550527df514624216366c0da125 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -181,9 +181,9 @@ void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame,
buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane),
buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane),
width, height);
- AsyncCapturerInvoke("OnIncomingFrame",
- &webrtc::AndroidVideoCapturer::OnIncomingFrame,
- buffer, rotation, timestamp_ns);
+
+ rtc::CritScope cs(&capturer_lock_);
+ capturer_->OnIncomingFrame(buffer, rotation, timestamp_ns);
magjed_webrtc 2016/05/18 15:29:11 You have introduced a race here. This code might b
}
void AndroidVideoCapturerJni::OnTextureFrame(int width,
@@ -194,9 +194,8 @@ void AndroidVideoCapturerJni::OnTextureFrame(int width,
rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
surface_texture_helper_->CreateTextureFrame(width, height, handle));
- AsyncCapturerInvoke("OnIncomingFrame",
- &webrtc::AndroidVideoCapturer::OnIncomingFrame,
- buffer, rotation, timestamp_ns);
+ rtc::CritScope cs(&capturer_lock_);
+ capturer_->OnIncomingFrame(buffer, rotation, timestamp_ns);
}
void AndroidVideoCapturerJni::OnOutputFormatRequest(int width,

Powered by Google App Engine
This is Rietveld 408576698