| Index: media/video/capture/win/video_capture_device_win.cc
|
| diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc
|
| index 55b5a16de823698b8bfe091b7b45f45bc2735e42..e239c63cb5e77311ed808459b528c753a35a3e11 100644
|
| --- a/media/video/capture/win/video_capture_device_win.cc
|
| +++ b/media/video/capture/win/video_capture_device_win.cc
|
| @@ -179,8 +179,8 @@ static const char kGoogleCameraAdapter[] = "google camera adapter";
|
| // Gets the names of all video capture devices connected to this computer.
|
| void VideoCaptureDevice::GetDeviceNames(Names* device_names) {
|
| DCHECK(device_names);
|
| + DCHECK(CalledOnValidThread());
|
|
|
| - base::win::ScopedCOMInitializer coinit;
|
| ScopedComPtr<ICreateDevEnum> dev_enum;
|
| HRESULT hr = dev_enum.CreateInstance(CLSID_SystemDeviceEnum, NULL,
|
| CLSCTX_INPROC);
|
| @@ -255,9 +255,11 @@ VideoCaptureDeviceWin::VideoCaptureDeviceWin(const Name& device_name)
|
| : device_name_(device_name),
|
| state_(kIdle),
|
| observer_(NULL) {
|
| + DetachFromThread();
|
| }
|
|
|
| VideoCaptureDeviceWin::~VideoCaptureDeviceWin() {
|
| + DCHECK(CalledOnValidThread());
|
| if (media_control_)
|
| media_control_->Stop();
|
|
|
| @@ -276,6 +278,7 @@ VideoCaptureDeviceWin::~VideoCaptureDeviceWin() {
|
| }
|
|
|
| bool VideoCaptureDeviceWin::Init() {
|
| + DCHECK(CalledOnValidThread());
|
| HRESULT hr = GetDeviceFilter(device_name_, capture_filter_.Receive());
|
| if (!capture_filter_) {
|
| DVLOG(2) << "Failed to create capture filter.";
|
| @@ -331,6 +334,7 @@ void VideoCaptureDeviceWin::Allocate(
|
| int height,
|
| int frame_rate,
|
| VideoCaptureDevice::EventHandler* observer) {
|
| + DCHECK(CalledOnValidThread());
|
| if (state_ != kIdle)
|
| return;
|
|
|
| @@ -427,6 +431,7 @@ void VideoCaptureDeviceWin::Allocate(
|
| }
|
|
|
| void VideoCaptureDeviceWin::Start() {
|
| + DCHECK(CalledOnValidThread());
|
| if (state_ != kAllocated)
|
| return;
|
|
|
| @@ -440,6 +445,7 @@ void VideoCaptureDeviceWin::Start() {
|
| }
|
|
|
| void VideoCaptureDeviceWin::Stop() {
|
| + DCHECK(CalledOnValidThread());
|
| if (state_ != kCapturing)
|
| return;
|
|
|
| @@ -453,6 +459,7 @@ void VideoCaptureDeviceWin::Stop() {
|
| }
|
|
|
| void VideoCaptureDeviceWin::DeAllocate() {
|
| + DCHECK(CalledOnValidThread());
|
| if (state_ == kIdle)
|
| return;
|
|
|
| @@ -475,6 +482,7 @@ void VideoCaptureDeviceWin::DeAllocate() {
|
| }
|
|
|
| const VideoCaptureDevice::Name& VideoCaptureDeviceWin::device_name() {
|
| + DCHECK(CalledOnValidThread());
|
| return device_name_;
|
| }
|
|
|
| @@ -485,6 +493,7 @@ void VideoCaptureDeviceWin::FrameReceived(const uint8* buffer,
|
| }
|
|
|
| bool VideoCaptureDeviceWin::CreateCapabilityMap() {
|
| + DCHECK(CalledOnValidThread());
|
| ScopedComPtr<IAMStreamConfig> stream_config;
|
| HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive());
|
| if (FAILED(hr)) {
|
| @@ -594,6 +603,7 @@ bool VideoCaptureDeviceWin::CreateCapabilityMap() {
|
| int VideoCaptureDeviceWin::GetBestMatchedCapability(int requested_width,
|
| int requested_height,
|
| int requested_frame_rate) {
|
| + DCHECK(CalledOnValidThread());
|
| std::list<ResolutionDiff> diff_list;
|
|
|
| // Loop through the candidates to create a list of differentials between the
|
| @@ -653,6 +663,7 @@ int VideoCaptureDeviceWin::GetBestMatchedCapability(int requested_width,
|
| }
|
|
|
| void VideoCaptureDeviceWin::SetErrorState(const char* reason) {
|
| + DCHECK(CalledOnValidThread());
|
| DVLOG(1) << reason;
|
| state_ = kError;
|
| observer_->OnError();
|
|
|