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

Issue 1307973002: AndroidVideoCapturerJni: Fix threading issues (Closed)

Created:
5 years, 4 months ago by magjed_webrtc
Modified:
5 years, 4 months ago
Reviewers:
AlexG, tommi
CC:
webrtc-reviews_webrtc.org, interface-changes_webrtc.org, rwolff_gocast.it, yujie_mao (webrtc), Andrew MacDonald, stefan-webrtc, tterriberry_mozilla.com, qiang.lu, niklas.enbom, mflodman
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

AndroidVideoCapturerJni: Fix threading issues The primary fix in this CL is to remove the dangling |thread_| pointer in AndroidVideoCapturerJni. That thread is not safe to use after Stop() has been called. Even after Stop() has been called, we must still be able to return late frames to Java in order to not leak them, so that path has been made thread safe instead. To make sure that we always return frames, the Java frame should be wrapped in a scoped_refptr as quickly as possible, so this CL moves the wrapping from AndroidVideoCapturer to AndroidVideoCapturerJni. This also removes the need for the interface function AndroidVideoCapturerDelegate::ReturnBuffer(). Some other minor changes are: * Remove |valid_global_refs_| and all logic related to that. Now that rtc::Bind() captures method objects as scoped_refptr, the destructor of AndroidVideoCapturerJni will not be called before all frames are returned. * Remove global ref |j_frame_observer_|. No need for this, we don’t call it and it is kept alive with standard Java memory management. * Add helper function ShallowCenterCrop() for VideoFrameBuffers. This functionality already exists in the constructor of WrappedI420Buffer, but it’s more convenient to have it as a separate function. BUG=webrtc:4742, webrtc:4909 R=glaznev@webrtc.org, tommi@webrtc.org Committed: https://chromium.googlesource.com/external/webrtc/+/c464f504dcb40ad40b5258875493f12783bd5fda

Patch Set 1 : #

Total comments: 10

Patch Set 2 : Addressing tommi@s comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -279 lines) Patch
M talk/app/webrtc/androidvideocapturer.h View 3 chunks +3 lines, -8 lines 0 comments Download
M talk/app/webrtc/androidvideocapturer.cc View 1 4 chunks +37 lines, -108 lines 0 comments Download
M talk/app/webrtc/java/jni/androidvideocapturer_jni.h View 3 chunks +15 lines, -19 lines 0 comments Download
M talk/app/webrtc/java/jni/androidvideocapturer_jni.cc View 1 8 chunks +69 lines, -95 lines 0 comments Download
M talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java View 7 chunks +10 lines, -18 lines 0 comments Download
M webrtc/common_video/interface/video_frame_buffer.h View 2 chunks +13 lines, -8 lines 0 comments Download
M webrtc/common_video/video_frame_buffer.cc View 4 chunks +49 lines, -22 lines 0 comments Download
M webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 18 (8 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1307973002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1307973002/1
5 years, 4 months ago (2015-08-21 14:29:07 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1307973002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1307973002/40001
5 years, 4 months ago (2015-08-22 18:56:23 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1307973002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1307973002/60001
5 years, 4 months ago (2015-08-22 19:22:46 UTC) #8
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-22 20:15:42 UTC) #10
magjed_webrtc
Please take a look.
5 years, 4 months ago (2015-08-24 07:33:22 UTC) #13
tommi
lgtm https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc File talk/app/webrtc/androidvideocapturer.cc (right): https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc#newcode92 talk/app/webrtc/androidvideocapturer.cc:92: : frame.release(); can we at some point change ...
5 years, 4 months ago (2015-08-24 09:14:42 UTC) #14
magjed_webrtc
https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc File talk/app/webrtc/androidvideocapturer.cc (right): https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc#newcode92 talk/app/webrtc/androidvideocapturer.cc:92: : frame.release(); On 2015/08/24 09:14:42, tommi (webrtc) wrote: > ...
5 years, 4 months ago (2015-08-24 11:27:19 UTC) #15
tommi
On 2015/08/24 11:27:19, magjed_webrtc wrote: > https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc > File talk/app/webrtc/androidvideocapturer.cc (right): > > https://codereview.webrtc.org/1307973002/diff/60001/talk/app/webrtc/androidvideocapturer.cc#newcode92 > ...
5 years, 4 months ago (2015-08-24 11:46:04 UTC) #16
AlexG
lgtm
5 years, 4 months ago (2015-08-25 18:08:51 UTC) #17
magjed_webrtc
5 years, 4 months ago (2015-08-25 21:22:30 UTC) #18
Message was sent while issue was closed.
Committed patchset #2 (id:80001) manually as
c464f504dcb40ad40b5258875493f12783bd5fda (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698