DCHECK(devices_.empty());
}
-void VideoCaptureManager::Register(MediaStreamProviderListener* listener,
- base::MessageLoopProxy* device_thread_loop) {
+void VideoCaptureManager::Register(
+ MediaStreamProviderListener* listener,
+ const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(!listener_);
- DCHECK(!device_loop_.get());
+ DCHECK(!device_task_runner_.get());
listener_ = listener;
- device_loop_ = device_thread_loop;
+ device_task_runner_ = device_task_runner;
}
void VideoCaptureManager::Unregister() {
DVLOG(1) << "VideoCaptureManager::EnumerateDevices, type " << stream_type;
DCHECK(listener_);
base::PostTaskAndReplyWithResult(
- device_loop_, FROM_HERE,
+ device_task_runner_, FROM_HERE,
base::Bind(&VideoCaptureManager::GetAvailableDevicesInfoOnDeviceThread,
this, stream_type, devices_info_cache_),
base::Bind(&VideoCaptureManager::OnDevicesInfoEnumerated, this,
DVLOG(1) << "VideoCaptureManager starting device (type = "
<< entry->stream_type << ", id = " << entry->id << ")";
- device_loop_->PostTask(
+ device_task_runner_->PostTask(
FROM_HERE,
base::Bind(
&VideoCaptureManager::DoStartDeviceOnDeviceThread,
return true;
}
-bool VideoCaptureManager::GetDeviceFormatInUse(
+bool VideoCaptureManager::GetDeviceFormatsInUse(
media::VideoCaptureSessionId capture_session_id,
- media::VideoCaptureFormat* format_in_use) {
+ media::VideoCaptureFormats* formats_in_use) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(formats_in_use->empty());
std::map<media::VideoCaptureSessionId, MediaStreamDevice>::iterator it =
sessions_.find(capture_session_id);
if (it == sessions_.end())
return false;
- DVLOG(1) << "GetDeviceFormatInUse for device: " << it->second.name;
+ DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name;
- // Return the currently in-use format of the device, if it's started.
+ // Return the currently in-use format(s) of the device, if it's started.
DeviceEntry* device_in_use =
GetDeviceEntryForMediaStreamDevice(it->second);
- if (!device_in_use)
- return false;
- *format_in_use =
- device_in_use->video_capture_controller->GetVideoCaptureFormat();
+ if (device_in_use) {
+ // Currently only one format-in-use is supported at the VCC level.
+ formats_in_use->push_back(
+ device_in_use->video_capture_controller->GetVideoCaptureFormat());
+ }
return true;
}
}
bool VideoCaptureManager::IsOnDeviceThread() const {
- return device_loop_->BelongsToCurrentThread();
+ return device_task_runner_->BelongsToCurrentThread();
}
VideoCaptureManager::DeviceInfos
// DeviceEntry, VideoCaptureController, and VideoCaptureDevice.
devices_.erase(entry);
entry->video_capture_controller.reset();
- device_loop_->PostTask(
+ device_task_runner_->PostTask(
FROM_HERE,
base::Bind(&VideoCaptureManager::DoStopDeviceOnDeviceThread, this,
base::Owned(entry)));