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

Issue 294893006: VideoCaptureDeviceFactory: Change device enumeration to callback + QTKit enumerates in UI thread. (Closed)

Created:
6 years, 7 months ago by mcasas
Modified:
6 years, 6 months ago
CC:
chromium-reviews, fischman+watch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, wjia+watch_chromium.org, miu+watch_chromium.org, DaleCurtis
Visibility:
Public.

Description

VideoCaptureDeviceFactory: change device enumeration to callback + QTKit enumerates in UI thread. This CL changes the Enumeration to be based on a callback passed to the VideoCaptureDeviceFactory. It is used for QTKit enumeration on UI thread: this is speculatively better than trying to run -performSelectorOnMainThread:withObject:waitUntilDone: -- Description -- Currently VCM::EnumerateDevices() issues an internal PostTaskAndReplyWithResult where the first part is GetAvailableDevicesInfoOnDeviceThread() on DeviceThread and the second is OnDevicesInfoEnumerated() in IO thread. This CL changes this to a simple PostTask to the VCDFactory::EnumerateDeviceNames() with a callback to VCM::ConsolidateDevicesInfoOnDeviceThread(). This method has a jump at the end to VCM::OnDevicesInfoEnumerated() on IO thread. So what used to be a simple back-and-forth jump is now a 3 hop process. This is used for QTKit to be able to override the VCDF::EnumerateDeviceNames and run the device enumeration in UI thread. Note 1: The UI thread is currently passed in Create() method for all implementations. This is changed to earlier: on VCDF::CreateFactory(); injected from MediaStreamManager; and only used in VCDFLinux (for ChromeOS) and in VCDFMac for QTKit enumeration. This approach is cleaner since we don't send UI thread references to derived classes that don't need it. Note 2: VideoCaptureDeviceFactoryMac::Create() used to have a search-and-find for |device_id| that is removed; the search was a precaution for devices that disappeared between first enumeration and use. However, using a |device_name| that is gone would just cause a fail on AllocateAndStart() anyhow, and enumerating twice is very expensive. For compatibility reasons, this behaviour is kept for AVFoundation devices and blacklisted QTKit devices (that behave as a subset of AVF-type ones). BUG=255552, 115327 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=274518

Patch Set 1 : #

Patch Set 2 : Adapted VCD unittests to enumeration via callback. #

Total comments: 19

Patch Set 3 : perkj@s first round of comments #

Total comments: 4

Patch Set 4 : perkj@s comments #

Total comments: 20

Patch Set 5 : tommi@s comments. ConsolidateDevicesInfoOnDeviceThread() uses a const&. #

Total comments: 2

Patch Set 6 : Changed |names_snapshot| to scoped_ptr<>. #

Patch Set 7 : Mac methods/functions changed to scoped_ptr<>. #

Patch Set 8 : QTKit/AVFoundation Factory create of inexistent device and associated unit tests #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+322 lines, -176 lines) Patch
M content/browser/renderer_host/media/media_stream_manager.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 2 3 4 5 5 chunks +21 lines, -18 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 2 3 4 5 9 chunks +40 lines, -37 lines 0 comments Download
M media/video/capture/android/video_capture_device_factory_android.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/video/capture/android/video_capture_device_factory_android.cc View 1 chunk +0 lines, -1 line 0 comments Download
M media/video/capture/fake_video_capture_device_factory.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/video/capture/fake_video_capture_device_factory.cc View 3 chunks +3 lines, -1 line 0 comments Download
M media/video/capture/fake_video_capture_device_unittest.cc View 1 2 3 4 5 6 chunks +42 lines, -16 lines 0 comments Download
M media/video/capture/file_video_capture_device_factory.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/video/capture/file_video_capture_device_factory.cc View 3 chunks +3 lines, -1 line 0 comments Download
M media/video/capture/linux/video_capture_device_factory_linux.h View 2 chunks +4 lines, -4 lines 0 comments Download
M media/video/capture/linux/video_capture_device_factory_linux.cc View 1 chunk +9 lines, -2 lines 0 comments Download
M media/video/capture/mac/video_capture_device_factory_mac.h View 1 2 3 4 5 6 7 1 chunk +10 lines, -3 lines 0 comments Download
M media/video/capture/mac/video_capture_device_factory_mac.mm View 1 2 3 4 5 6 7 4 chunks +69 lines, -18 lines 6 comments Download
M media/video/capture/mac/video_capture_device_factory_mac_unittest.mm View 2 chunks +3 lines, -1 line 0 comments Download
M media/video/capture/mac/video_capture_device_qtkit_mac.h View 1 chunk +7 lines, -1 line 0 comments Download
M media/video/capture/video_capture_device_factory.h View 1 2 3 4 5 2 chunks +11 lines, -6 lines 0 comments Download
M media/video/capture/video_capture_device_factory.cc View 1 2 3 4 5 3 chunks +13 lines, -25 lines 0 comments Download
M media/video/capture/video_capture_device_unittest.cc View 1 2 3 4 5 6 7 15 chunks +84 lines, -35 lines 0 comments Download
M media/video/capture/win/video_capture_device_factory_win.h View 1 chunk +0 lines, -1 line 0 comments Download
M media/video/capture/win/video_capture_device_factory_win.cc View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 40 (0 generated)
mcasas
Ami: content/browser/renderer_host/media/* PTAL. (and beyond if you want)
6 years, 7 months ago (2014-05-22 12:19:08 UTC) #1
mcasas
tommi@ PTAL.
6 years, 7 months ago (2014-05-23 08:12:39 UTC) #2
mcasas
perkj@ PTAL.
6 years, 7 months ago (2014-05-26 10:00:39 UTC) #3
perkj_chrome
https://codereview.chromium.org/294893006/diff/110001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/110001/content/browser/renderer_host/media/video_capture_manager.cc#newcode126 content/browser/renderer_host/media/video_capture_manager.cc:126: if (stream_type == MEDIA_DESKTOP_VIDEO_CAPTURE) { THis looks weird. Why ...
6 years, 7 months ago (2014-05-26 11:49:42 UTC) #4
mcasas
perkj@ PTAL. https://codereview.chromium.org/294893006/diff/110001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/110001/content/browser/renderer_host/media/video_capture_manager.cc#newcode126 content/browser/renderer_host/media/video_capture_manager.cc:126: if (stream_type == MEDIA_DESKTOP_VIDEO_CAPTURE) { On 2014/05/26 ...
6 years, 7 months ago (2014-05-26 13:00:18 UTC) #5
perkj_chrome
I am happy with this if you address the below comments and I think its ...
6 years, 7 months ago (2014-05-27 12:15:07 UTC) #6
mcasas
tommi@ PTAL. dalecurtis@ what do you think about this approach? https://codereview.chromium.org/294893006/diff/130001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/130001/content/browser/renderer_host/media/video_capture_manager.cc#newcode134 ...
6 years, 7 months ago (2014-05-27 15:23:40 UTC) #7
DaleCurtis
I'm far enough removed from this code to not really have a useful opinion :) ...
6 years, 7 months ago (2014-05-27 17:51:07 UTC) #8
mcasas
On 2014/05/27 17:51:07, DaleCurtis wrote: > I'm far enough removed from this code to not ...
6 years, 6 months ago (2014-05-28 08:04:49 UTC) #9
mcasas
perkj@, does "happy" mean LGTY?
6 years, 6 months ago (2014-05-29 13:47:14 UTC) #10
tommi (sloooow) - chröme
https://codereview.chromium.org/294893006/diff/150001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/150001/content/browser/renderer_host/media/video_capture_manager.cc#newcode132 content/browser/renderer_host/media/video_capture_manager.cc:132: base::Callback<void(media::VideoCaptureDevice::Names&)> either const& or * https://codereview.chromium.org/294893006/diff/150001/content/browser/renderer_host/media/video_capture_manager.h File content/browser/renderer_host/media/video_capture_manager.h (right): ...
6 years, 6 months ago (2014-05-30 12:37:51 UTC) #11
mcasas
tommi@ PTAL. perkj@ ping. https://codereview.chromium.org/294893006/diff/150001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/150001/content/browser/renderer_host/media/video_capture_manager.cc#newcode132 content/browser/renderer_host/media/video_capture_manager.cc:132: base::Callback<void(media::VideoCaptureDevice::Names&)> On 2014/05/30 12:37:51, tommi ...
6 years, 6 months ago (2014-05-30 14:08:49 UTC) #12
tommi (sloooow) - chröme
https://codereview.chromium.org/294893006/diff/170001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/170001/content/browser/renderer_host/media/video_capture_manager.cc#newcode484 content/browser/renderer_host/media/video_capture_manager.cc:484: media::VideoCaptureDevice::Names current_devices(names_snapshot); ah, so if the goal is actually ...
6 years, 6 months ago (2014-05-30 14:16:38 UTC) #13
mcasas
PTAL. https://codereview.chromium.org/294893006/diff/170001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/294893006/diff/170001/content/browser/renderer_host/media/video_capture_manager.cc#newcode484 content/browser/renderer_host/media/video_capture_manager.cc:484: media::VideoCaptureDevice::Names current_devices(names_snapshot); On 2014/05/30 14:16:38, tommi wrote: > ...
6 years, 6 months ago (2014-05-30 19:42:47 UTC) #14
tommi (sloooow) - chröme
thanks! lgtm
6 years, 6 months ago (2014-05-30 21:23:34 UTC) #15
mcasas
The CQ bit was checked by mcasas@chromium.org
6 years, 6 months ago (2014-05-31 11:48:11 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mcasas@chromium.org/294893006/190001
6 years, 6 months ago (2014-05-31 11:48:57 UTC) #17
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: mac_chromium_compile_dbg on tryserver.chromium ...
6 years, 6 months ago (2014-05-31 13:48:04 UTC) #18
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-05-31 13:48:48 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: win_gpu_triggered_tests on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/win_gpu_triggered_tests/builds/12609)
6 years, 6 months ago (2014-05-31 13:48:49 UTC) #20
mcasas
The CQ bit was checked by mcasas@chromium.org
6 years, 6 months ago (2014-05-31 14:36:02 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mcasas@chromium.org/294893006/230001
6 years, 6 months ago (2014-05-31 14:36:34 UTC) #22
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: mac_chromium_rel on tryserver.chromium ...
6 years, 6 months ago (2014-05-31 16:35:43 UTC) #23
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-05-31 16:36:37 UTC) #24
commit-bot: I haz the power
Try jobs failed on following builders: win_gpu_triggered_tests on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/win_gpu_triggered_tests/builds/12614)
6 years, 6 months ago (2014-05-31 16:36:38 UTC) #25
mcasas
The CQ bit was checked by mcasas@chromium.org
6 years, 6 months ago (2014-05-31 19:31:39 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mcasas@chromium.org/294893006/230001
6 years, 6 months ago (2014-05-31 19:32:18 UTC) #27
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: mac_chromium_rel on tryserver.chromium ...
6 years, 6 months ago (2014-05-31 22:13:13 UTC) #28
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-01 00:01:15 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/mac_chromium_rel/builds/34426)
6 years, 6 months ago (2014-06-01 00:01:15 UTC) #30
mcasas
The CQ bit was checked by mcasas@chromium.org
6 years, 6 months ago (2014-06-01 10:13:02 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mcasas@chromium.org/294893006/280001
6 years, 6 months ago (2014-06-01 10:13:11 UTC) #32
tommi (sloooow) - chröme
https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm File media/video/capture/mac/video_capture_device_factory_mac.mm (right): https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm#newcode76 media/video/capture/mac/video_capture_device_factory_mac.mm:76: GetDeviceNames(device_names.get()); Doesn't this also enumerate QTKit devices? (Blackmagic) https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm#newcode84 ...
6 years, 6 months ago (2014-06-01 11:25:21 UTC) #33
mcasas
The CQ bit was unchecked by mcasas@chromium.org
6 years, 6 months ago (2014-06-01 11:44:45 UTC) #34
mcasas
tommi@ PTAL. A bit of an extensive answer, hope I addressed your comments. https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm File ...
6 years, 6 months ago (2014-06-02 13:19:03 UTC) #35
tommi (sloooow) - chröme
lgtm. Please check that my understanding below is correct. https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm File media/video/capture/mac/video_capture_device_factory_mac.mm (right): https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm#newcode84 media/video/capture/mac/video_capture_device_factory_mac.mm:84: ...
6 years, 6 months ago (2014-06-03 08:52:10 UTC) #36
mcasas
https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm File media/video/capture/mac/video_capture_device_factory_mac.mm (right): https://codereview.chromium.org/294893006/diff/280001/media/video/capture/mac/video_capture_device_factory_mac.mm#newcode84 media/video/capture/mac/video_capture_device_factory_mac.mm:84: return scoped_ptr<VideoCaptureDevice>(); On 2014/06/03 08:52:11, tommi wrote: > On ...
6 years, 6 months ago (2014-06-03 13:56:45 UTC) #37
mcasas
The CQ bit was checked by mcasas@chromium.org
6 years, 6 months ago (2014-06-03 13:56:53 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mcasas@chromium.org/294893006/280001
6 years, 6 months ago (2014-06-03 13:57:51 UTC) #39
commit-bot: I haz the power
6 years, 6 months ago (2014-06-03 13:59:19 UTC) #40
Message was sent while issue was closed.
Change committed as 274518

Powered by Google App Engine
This is Rietveld 408576698