| 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 de2130097ad69ba2a888136c9233ac1de67a8139..83e1bd3919a3c240b5754884572eaeb228f6049f 100644
|
| --- a/media/video/capture/win/video_capture_device_win.cc
|
| +++ b/media/video/capture/win/video_capture_device_win.cc
|
| @@ -306,8 +306,7 @@
|
| return false;
|
| }
|
|
|
| - return CreateCapabilityMap(
|
| - output_capture_pin_, capture_filter_, &capabilities_);
|
| + return CreateCapabilityMap();
|
| }
|
|
|
| void VideoCaptureDeviceWin::AllocateAndStart(
|
| @@ -474,12 +473,11 @@
|
| buffer, length, capture_format_, 0, base::TimeTicks::Now());
|
| }
|
|
|
| -bool VideoCaptureDeviceWin::CreateCapabilityMap(IPin* output_capture_pin,
|
| - IBaseFilter* capture_filter,
|
| - CapabilityList* capabilities) {
|
| +bool VideoCaptureDeviceWin::CreateCapabilityMap() {
|
| + DCHECK(CalledOnValidThread());
|
| ScopedComPtr<IAMStreamConfig> stream_config;
|
| - HRESULT hr = output_capture_pin->QueryInterface(stream_config.Receive());
|
| - if (FAILED(hr) || !stream_config) {
|
| + HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive());
|
| + if (FAILED(hr)) {
|
| DPLOG(ERROR) << "Failed to get IAMStreamConfig interface from "
|
| "capture device: " << logging::SystemErrorCodeToString(hr);
|
| return false;
|
| @@ -487,10 +485,9 @@
|
|
|
| // Get interface used for getting the frame rate.
|
| ScopedComPtr<IAMVideoControl> video_control;
|
| - hr = capture_filter->QueryInterface(video_control.Receive());
|
| - DLOG_IF(WARNING, FAILED(hr) || !video_control)
|
| - << "IAMVideoControl Interface NOT SUPPORTED: "
|
| - << logging::SystemErrorCodeToString(hr);
|
| + hr = capture_filter_.QueryInterface(video_control.Receive());
|
| + DLOG_IF(WARNING, FAILED(hr)) << "IAMVideoControl Interface NOT SUPPORTED: "
|
| + << logging::SystemErrorCodeToString(hr);
|
|
|
| int count = 0, size = 0;
|
| hr = stream_config->GetNumberOfCapabilities(&count, &size);
|
| @@ -507,7 +504,7 @@
|
| stream_index, media_type.Receive(), caps.get());
|
| // GetStreamCaps() may return S_FALSE, so don't use FAILED() or SUCCEED()
|
| // macros here since they'll trigger incorrectly.
|
| - if (hr != S_OK || !media_type.get()) {
|
| + if (hr != S_OK) {
|
| DLOG(ERROR) << "Failed to GetStreamCaps: "
|
| << logging::SystemErrorCodeToString(hr);
|
| return false;
|
| @@ -523,10 +520,6 @@
|
|
|
| VIDEOINFOHEADER* h =
|
| reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
|
| - if (!h) {
|
| - DLOG(ERROR) << "VIDEOINFOHEADER is NULL";
|
| - continue;
|
| - }
|
| format.frame_size.SetSize(h->bmiHeader.biWidth, h->bmiHeader.biHeight);
|
|
|
| // Try to get a better |time_per_frame| from IAMVideoControl. If not, use
|
| @@ -538,7 +531,7 @@
|
| const SIZE size = {format.frame_size.width(),
|
| format.frame_size.height()};
|
| hr = video_control->GetFrameRateList(
|
| - output_capture_pin, stream_index, size, &list_size, &max_fps);
|
| + output_capture_pin_, stream_index, size, &list_size, &max_fps);
|
| // Can't assume the first value will return the max fps.
|
| // Sometimes |list_size| will be > 0, but max_fps will be NULL. Some
|
| // drivers may return an HRESULT of S_FALSE which SUCCEEDED() translates
|
| @@ -554,11 +547,11 @@
|
| ? (kSecondsToReferenceTime / static_cast<float>(time_per_frame))
|
| : 0.0;
|
|
|
| - capabilities->emplace_back(stream_index, format);
|
| - }
|
| - }
|
| -
|
| - return !capabilities->empty();
|
| + capabilities_.emplace_back(stream_index, format);
|
| + }
|
| + }
|
| +
|
| + return !capabilities_.empty();
|
| }
|
|
|
| // Set the power line frequency removal in |capture_filter_| if available.
|
|
|