DescriptionVideoCaptureDeviceFactory: 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
Messages
Total messages: 40 (0 generated)
|