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

Issue 24133002: Make VideoCaptureController single-threaded and not ref counted. (Closed)

Created:
7 years, 3 months ago by ncarter (slow)
Modified:
7 years, 3 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, feature-media-reviews_chromium.org, miu+watch_chromium.org, jam, darin-cc_chromium.org, mcasas, miu, sheu, bemasc, Wez, vrk (LEFT CHROMIUM), tommi (sloooow) - chröme
Visibility:
Public.

Description

Make VideoCaptureController single-threaded and not ref counted. Merge Allocate+Start, Stop+DeAllocate. Move the non-IO thread parts of VideoCaptureController, which were precisely the VideoCaptureDevice::EventHandler implementation, into a new class VCC::VideoCaptureDeviceClient, which retains only a WeakPtr to the VCC. Change the contract between VideoCaptureDevice and its client so that (1) The Start+Allocate, and Stop+DeAllocate phases of VCD are merged, and (2) the VCD owns its EventHandler*; which is to say, the VCD owns the VideoCaptureDeviceClient. The merging of the phases is justified because it will eliminate intermediate states from the 6+ implementations of the VideoCaptureDevices. The new VCD::EH ownership model is justified because it will enable some of the impls (MFWin, desktop capture, and tab capture, at least) to eliminate locks protecting the EventHandler* from being synchronously removed at the DeAllocate() step. Rather than make deep changes to each VCD implementation with this change, the interface changes to VideoCaptureDevice are effected through a new shim class, VideoCaptureDevice1, which bridges the old and new interfaces. Follow-on changes will eliminate this shim class, one VideoCaptureDevice implementation at a time. BUG=285562, 285569 TEST=unittests,basic webcam interaction Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=223307

Patch Set 1 #

Patch Set 2 : De-inline nontrivial methods. #

Patch Set 3 : Give VCD1 a ctor. #

Patch Set 4 : dtor for VCDC #

Patch Set 5 : Fix android build. #

Patch Set 6 : Fix a memory leak #

Total comments: 34

Patch Set 7 : Ami's fixes, typedef the callback, etc. etc. #

Patch Set 8 : More longwinded hobbledy-nobble #

Total comments: 10

Patch Set 9 : More fixes. #

Patch Set 10 : Clear up the comment on StopAndDeAllocate #

Patch Set 11 : git pull #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+468 lines, -461 lines) Patch
M content/browser/renderer_host/media/desktop_capture_device.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.h View 1 2 3 4 5 6 7 chunks +29 lines, -52 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_controller.cc View 1 2 3 4 5 6 7 8 13 chunks +143 lines, -87 lines 3 comments Download
M content/browser/renderer_host/media/video_capture_controller_unittest.cc View 14 chunks +27 lines, -25 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.h View 1 2 3 4 5 6 7 8 3 chunks +9 lines, -5 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.cc View 1 2 3 4 5 6 7 chunks +15 lines, -28 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 2 3 4 5 6 7 8 7 chunks +17 lines, -19 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 4 5 6 7 8 11 chunks +25 lines, -36 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager_unittest.cc View 1 2 3 4 5 6 1 chunk +7 lines, -6 lines 0 comments Download
M content/browser/renderer_host/media/web_contents_video_capture_device.h View 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/media/web_contents_video_capture_device.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -2 lines 0 comments Download
M media/video/capture/android/video_capture_device_android.h View 1 chunk +1 line, -1 line 0 comments Download
M media/video/capture/fake_video_capture_device.h View 2 chunks +2 lines, -2 lines 0 comments Download
M media/video/capture/linux/video_capture_device_linux.h View 1 chunk +1 line, -1 line 0 comments Download
M media/video/capture/mac/video_capture_device_mac.h View 1 chunk +1 line, -1 line 0 comments Download
M media/video/capture/video_capture_device.h View 1 2 3 4 5 6 7 8 9 5 chunks +56 lines, -15 lines 2 comments Download
M media/video/capture/video_capture_device.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +21 lines, -0 lines 0 comments Download
D media/video/capture/video_capture_device_dummy.h View 1 chunk +0 lines, -37 lines 0 comments Download
D media/video/capture/video_capture_device_dummy.cc View 1 chunk +0 lines, -30 lines 0 comments Download
M media/video/capture/video_capture_device_unittest.cc View 11 chunks +105 lines, -105 lines 0 comments Download
M media/video/capture/win/video_capture_device_mf_win.h View 1 chunk +1 line, -1 line 0 comments Download
M media/video/capture/win/video_capture_device_win.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14 (0 generated)
ncarter (slow)
7 years, 3 months ago (2013-09-13 06:23:14 UTC) #1
ncarter (slow)
This is ready for review now.
7 years, 3 months ago (2013-09-13 18:13:23 UTC) #2
Ami GONE FROM CHROMIUM
https://codereview.chromium.org/24133002/diff/69001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/24133002/diff/69001/content/browser/renderer_host/media/video_capture_controller.cc#newcode119 content/browser/renderer_host/media/video_capture_controller.cc:119: return result.Pass(); l.117-119 are equiv to return make_scoped_ptr(new VideoCaptureDeviceClient(this->AsWeakPtr()))); ...
7 years, 3 months ago (2013-09-13 21:17:59 UTC) #3
ncarter (slow)
https://codereview.chromium.org/24133002/diff/69001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/24133002/diff/69001/content/browser/renderer_host/media/video_capture_controller.cc#newcode119 content/browser/renderer_host/media/video_capture_controller.cc:119: return result.Pass(); On 2013/09/13 21:17:59, Ami Fischman wrote: > ...
7 years, 3 months ago (2013-09-14 00:07:23 UTC) #4
Ami GONE FROM CHROMIUM
https://codereview.chromium.org/24133002/diff/95001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/24133002/diff/95001/content/browser/renderer_host/media/video_capture_controller.cc#newcode103 content/browser/renderer_host/media/video_capture_controller.cc:103: // v4l2_thread on Linux, and the UI thread for ...
7 years, 3 months ago (2013-09-14 00:32:23 UTC) #5
ncarter (slow)
https://codereview.chromium.org/24133002/diff/95001/content/browser/renderer_host/media/video_capture_controller.cc File content/browser/renderer_host/media/video_capture_controller.cc (right): https://codereview.chromium.org/24133002/diff/95001/content/browser/renderer_host/media/video_capture_controller.cc#newcode103 content/browser/renderer_host/media/video_capture_controller.cc:103: // v4l2_thread on Linux, and the UI thread for ...
7 years, 3 months ago (2013-09-14 01:29:30 UTC) #6
Ami GONE FROM CHROMIUM
lgtm To unsubscribe from this group and stop receiving emails from it, send an email ...
7 years, 3 months ago (2013-09-14 02:16:29 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nick@chromium.org/24133002/110001
7 years, 3 months ago (2013-09-14 22:11:15 UTC) #8
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 3 months ago (2013-09-14 22:18:07 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nick@chromium.org/24133002/83001
7 years, 3 months ago (2013-09-15 21:24:51 UTC) #10
commit-bot: I haz the power
Change committed as 223307
7 years, 3 months ago (2013-09-16 03:05:29 UTC) #11
perkj_chrome
Nice- please also see the discussion in https://codereview.chromium.org/24079003/ https://codereview.chromium.org/24133002/diff/83001/media/video/capture/video_capture_device.h File media/video/capture/video_capture_device.h (right): https://codereview.chromium.org/24133002/diff/83001/media/video/capture/video_capture_device.h#newcode123 media/video/capture/video_capture_device.h:123: virtual ...
7 years, 3 months ago (2013-09-16 08:50:15 UTC) #12
ncarter (slow)
https://codereview.chromium.org/24133002/diff/83001/media/video/capture/video_capture_device.h File media/video/capture/video_capture_device.h (right): https://codereview.chromium.org/24133002/diff/83001/media/video/capture/video_capture_device.h#newcode123 media/video/capture/video_capture_device.h:123: virtual ~EventHandler() {} On 2013/09/16 08:50:15, perkj wrote: > ...
7 years, 3 months ago (2013-09-16 15:18:17 UTC) #13
wjia(left Chromium)
7 years, 3 months ago (2013-09-18 01:29:01 UTC) #14
Message was sent while issue was closed.
https://codereview.chromium.org/24133002/diff/83001/content/browser/renderer_...
File content/browser/renderer_host/media/video_capture_controller.cc (right):

https://codereview.chromium.org/24133002/diff/83001/content/browser/renderer_...
content/browser/renderer_host/media/video_capture_controller.cc:145: :
state_(VIDEO_CAPTURE_STATE_STARTED),
|state_| is not really needed any more since there are only 2 states: valid and
error. A boolean is good enough, e.g., has_error_.

https://codereview.chromium.org/24133002/diff/83001/content/browser/renderer_...
content/browser/renderer_host/media/video_capture_controller.cc:671:
reserved_frame->shared_memory_handle());
In case number of live clients (i.e., the |count| below) is zero, does it make
sense to reserve a buffer?

https://codereview.chromium.org/24133002/diff/83001/content/browser/renderer_...
content/browser/renderer_host/media/video_capture_controller.cc:700: // Allocate
memory only when device has been started.
This would be changed to "Allocate memory only when device has no error.".

Powered by Google App Engine
This is Rietveld 408576698