| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/video_capture/windows/video_capture_ds.h" | 11 #include "webrtc/modules/video_capture/windows/video_capture_ds.h" |
| 12 | 12 |
| 13 #include "webrtc/modules/video_capture/video_capture_config.h" | 13 #include "webrtc/modules/video_capture/video_capture_config.h" |
| 14 #include "webrtc/modules/video_capture/windows/help_functions_ds.h" | 14 #include "webrtc/modules/video_capture/windows/help_functions_ds.h" |
| 15 #include "webrtc/modules/video_capture/windows/sink_filter_ds.h" | 15 #include "webrtc/modules/video_capture/windows/sink_filter_ds.h" |
| 16 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 16 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 17 #include "webrtc/system_wrappers/include/trace.h" | 17 #include "webrtc/system_wrappers/include/trace.h" |
| 18 | 18 |
| 19 #include <Dvdmedia.h> // VIDEOINFOHEADER2 | 19 #include <Dvdmedia.h> // VIDEOINFOHEADER2 |
| 20 | 20 |
| 21 namespace webrtc | 21 namespace webrtc |
| 22 { | 22 { |
| 23 namespace videocapturemodule | 23 namespace videocapturemodule |
| 24 { | 24 { |
| 25 VideoCaptureDS::VideoCaptureDS(const int32_t id) | 25 VideoCaptureDS::VideoCaptureDS() |
| 26 : VideoCaptureImpl(id), _dsInfo(id), _captureFilter(NULL), | 26 : _captureFilter(NULL), |
| 27 _graphBuilder(NULL), _mediaControl(NULL), _sinkFilter(NULL), | 27 _graphBuilder(NULL), _mediaControl(NULL), _sinkFilter(NULL), |
| 28 _inputSendPin(NULL), _outputCapturePin(NULL), _dvFilter(NULL), | 28 _inputSendPin(NULL), _outputCapturePin(NULL), _dvFilter(NULL), |
| 29 _inputDvPin(NULL), _outputDvPin(NULL) | 29 _inputDvPin(NULL), _outputDvPin(NULL) |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 | 32 |
| 33 VideoCaptureDS::~VideoCaptureDS() | 33 VideoCaptureDS::~VideoCaptureDS() |
| 34 { | 34 { |
| 35 if (_mediaControl) | 35 if (_mediaControl) |
| 36 { | 36 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 RELEASE_AND_CLEAR(_dvFilter); | 53 RELEASE_AND_CLEAR(_dvFilter); |
| 54 | 54 |
| 55 RELEASE_AND_CLEAR(_mediaControl); | 55 RELEASE_AND_CLEAR(_mediaControl); |
| 56 | 56 |
| 57 RELEASE_AND_CLEAR(_inputDvPin); | 57 RELEASE_AND_CLEAR(_inputDvPin); |
| 58 RELEASE_AND_CLEAR(_outputDvPin); | 58 RELEASE_AND_CLEAR(_outputDvPin); |
| 59 | 59 |
| 60 RELEASE_AND_CLEAR(_graphBuilder); | 60 RELEASE_AND_CLEAR(_graphBuilder); |
| 61 } | 61 } |
| 62 | 62 |
| 63 int32_t VideoCaptureDS::Init(const int32_t id, const char* deviceUniqueIdUTF8) | 63 int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) |
| 64 { | 64 { |
| 65 const int32_t nameLength = | 65 const int32_t nameLength = |
| 66 (int32_t) strlen((char*) deviceUniqueIdUTF8); | 66 (int32_t) strlen((char*) deviceUniqueIdUTF8); |
| 67 if (nameLength > kVideoCaptureUniqueNameLength) | 67 if (nameLength > kVideoCaptureUniqueNameLength) |
| 68 return -1; | 68 return -1; |
| 69 | 69 |
| 70 // Store the device name | 70 // Store the device name |
| 71 _deviceUniqueId = new (std::nothrow) char[nameLength + 1]; | 71 _deviceUniqueId = new (std::nothrow) char[nameLength + 1]; |
| 72 memcpy(_deviceUniqueId, deviceUniqueIdUTF8, nameLength + 1); | 72 memcpy(_deviceUniqueId, deviceUniqueIdUTF8, nameLength + 1); |
| 73 | 73 |
| 74 if (_dsInfo.Init() != 0) | 74 if (_dsInfo.Init() != 0) |
| 75 return -1; | 75 return -1; |
| 76 | 76 |
| 77 _captureFilter = _dsInfo.GetDeviceFilter(deviceUniqueIdUTF8); | 77 _captureFilter = _dsInfo.GetDeviceFilter(deviceUniqueIdUTF8); |
| 78 if (!_captureFilter) | 78 if (!_captureFilter) |
| 79 { | 79 { |
| 80 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 80 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 81 "Failed to create capture filter."); | 81 "Failed to create capture filter."); |
| 82 return -1; | 82 return -1; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Get the interface for DirectShow's GraphBuilder | 85 // Get the interface for DirectShow's GraphBuilder |
| 86 HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, | 86 HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, |
| 87 CLSCTX_INPROC_SERVER, IID_IGraphBuilder, | 87 CLSCTX_INPROC_SERVER, IID_IGraphBuilder, |
| 88 (void **) &_graphBuilder); | 88 (void **) &_graphBuilder); |
| 89 if (FAILED(hr)) | 89 if (FAILED(hr)) |
| 90 { | 90 { |
| 91 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 91 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 92 "Failed to create graph builder."); | 92 "Failed to create graph builder."); |
| 93 return -1; | 93 return -1; |
| 94 } | 94 } |
| 95 | 95 |
| 96 hr = _graphBuilder->QueryInterface(IID_IMediaControl, | 96 hr = _graphBuilder->QueryInterface(IID_IMediaControl, |
| 97 (void **) &_mediaControl); | 97 (void **) &_mediaControl); |
| 98 if (FAILED(hr)) | 98 if (FAILED(hr)) |
| 99 { | 99 { |
| 100 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 100 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 101 "Failed to create media control builder."); | 101 "Failed to create media control builder."); |
| 102 return -1; | 102 return -1; |
| 103 } | 103 } |
| 104 hr = _graphBuilder->AddFilter(_captureFilter, CAPTURE_FILTER_NAME); | 104 hr = _graphBuilder->AddFilter(_captureFilter, CAPTURE_FILTER_NAME); |
| 105 if (FAILED(hr)) | 105 if (FAILED(hr)) |
| 106 { | 106 { |
| 107 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 107 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 108 "Failed to add the capture device to the graph."); | 108 "Failed to add the capture device to the graph."); |
| 109 return -1; | 109 return -1; |
| 110 } | 110 } |
| 111 | 111 |
| 112 _outputCapturePin = GetOutputPin(_captureFilter, PIN_CATEGORY_CAPTURE); | 112 _outputCapturePin = GetOutputPin(_captureFilter, PIN_CATEGORY_CAPTURE); |
| 113 | 113 |
| 114 // Create the sink filte used for receiving Captured frames. | 114 // Create the sink filte used for receiving Captured frames. |
| 115 _sinkFilter = new CaptureSinkFilter(SINK_FILTER_NAME, NULL, &hr, | 115 _sinkFilter = new CaptureSinkFilter(SINK_FILTER_NAME, NULL, &hr, |
| 116 *this, _id); | 116 *this); |
| 117 if (hr != S_OK) | 117 if (hr != S_OK) |
| 118 { | 118 { |
| 119 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 119 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 120 "Failed to create send filter"); | 120 "Failed to create send filter"); |
| 121 return -1; | 121 return -1; |
| 122 } | 122 } |
| 123 _sinkFilter->AddRef(); | 123 _sinkFilter->AddRef(); |
| 124 | 124 |
| 125 hr = _graphBuilder->AddFilter(_sinkFilter, SINK_FILTER_NAME); | 125 hr = _graphBuilder->AddFilter(_sinkFilter, SINK_FILTER_NAME); |
| 126 if (FAILED(hr)) | 126 if (FAILED(hr)) |
| 127 { | 127 { |
| 128 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 128 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 129 "Failed to add the send filter to the graph."); | 129 "Failed to add the send filter to the graph."); |
| 130 return -1; | 130 return -1; |
| 131 } | 131 } |
| 132 _inputSendPin = GetInputPin(_sinkFilter); | 132 _inputSendPin = GetInputPin(_sinkFilter); |
| 133 | 133 |
| 134 // Temporary connect here. | 134 // Temporary connect here. |
| 135 // This is done so that no one else can use the capture device. | 135 // This is done so that no one else can use the capture device. |
| 136 if (SetCameraOutput(_requestedCapability) != 0) | 136 if (SetCameraOutput(_requestedCapability) != 0) |
| 137 { | 137 { |
| 138 return -1; | 138 return -1; |
| 139 } | 139 } |
| 140 hr = _mediaControl->Pause(); | 140 hr = _mediaControl->Pause(); |
| 141 if (FAILED(hr)) | 141 if (FAILED(hr)) |
| 142 { | 142 { |
| 143 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 143 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 144 "Failed to Pause the Capture device. Is it already occupied
? %d.", | 144 "Failed to Pause the Capture device. Is it already occupied
? %d.", |
| 145 hr); | 145 hr); |
| 146 return -1; | 146 return -1; |
| 147 } | 147 } |
| 148 WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, _id, | 148 WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, 0, |
| 149 "Capture device '%s' initialized.", deviceUniqueIdUTF8); | 149 "Capture device '%s' initialized.", deviceUniqueIdUTF8); |
| 150 return 0; | 150 return 0; |
| 151 } | 151 } |
| 152 | 152 |
| 153 int32_t VideoCaptureDS::StartCapture( | 153 int32_t VideoCaptureDS::StartCapture( |
| 154 const VideoCaptureCapability& capability) | 154 const VideoCaptureCapability& capability) |
| 155 { | 155 { |
| 156 CriticalSectionScoped cs(&_apiCs); | 156 CriticalSectionScoped cs(&_apiCs); |
| 157 | 157 |
| 158 if (capability != _requestedCapability) | 158 if (capability != _requestedCapability) |
| 159 { | 159 { |
| 160 DisconnectGraph(); | 160 DisconnectGraph(); |
| 161 | 161 |
| 162 if (SetCameraOutput(capability) != 0) | 162 if (SetCameraOutput(capability) != 0) |
| 163 { | 163 { |
| 164 return -1; | 164 return -1; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 HRESULT hr = _mediaControl->Run(); | 167 HRESULT hr = _mediaControl->Run(); |
| 168 if (FAILED(hr)) | 168 if (FAILED(hr)) |
| 169 { | 169 { |
| 170 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 170 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 171 "Failed to start the Capture device."); | 171 "Failed to start the Capture device."); |
| 172 return -1; | 172 return -1; |
| 173 } | 173 } |
| 174 return 0; | 174 return 0; |
| 175 } | 175 } |
| 176 | 176 |
| 177 int32_t VideoCaptureDS::StopCapture() | 177 int32_t VideoCaptureDS::StopCapture() |
| 178 { | 178 { |
| 179 CriticalSectionScoped cs(&_apiCs); | 179 CriticalSectionScoped cs(&_apiCs); |
| 180 | 180 |
| 181 HRESULT hr = _mediaControl->Pause(); | 181 HRESULT hr = _mediaControl->Pause(); |
| 182 if (FAILED(hr)) | 182 if (FAILED(hr)) |
| 183 { | 183 { |
| 184 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 184 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 185 "Failed to stop the capture graph. %d", hr); | 185 "Failed to stop the capture graph. %d", hr); |
| 186 return -1; | 186 return -1; |
| 187 } | 187 } |
| 188 return 0; | 188 return 0; |
| 189 } | 189 } |
| 190 bool VideoCaptureDS::CaptureStarted() | 190 bool VideoCaptureDS::CaptureStarted() |
| 191 { | 191 { |
| 192 OAFilterState state = 0; | 192 OAFilterState state = 0; |
| 193 HRESULT hr = _mediaControl->GetState(1000, &state); | 193 HRESULT hr = _mediaControl->GetState(1000, &state); |
| 194 if (hr != S_OK && hr != VFW_S_CANT_CUE) | 194 if (hr != S_OK && hr != VFW_S_CANT_CUE) |
| 195 { | 195 { |
| 196 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 196 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 197 "Failed to get the CaptureStarted status"); | 197 "Failed to get the CaptureStarted status"); |
| 198 } | 198 } |
| 199 WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id, | 199 WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, |
| 200 "CaptureStarted %d", state); | 200 "CaptureStarted %d", state); |
| 201 return state == State_Running; | 201 return state == State_Running; |
| 202 | 202 |
| 203 } | 203 } |
| 204 int32_t VideoCaptureDS::CaptureSettings( | 204 int32_t VideoCaptureDS::CaptureSettings( |
| 205 VideoCaptureCapability& settings) | 205 VideoCaptureCapability& settings) |
| 206 { | 206 { |
| 207 settings = _requestedCapability; | 207 settings = _requestedCapability; |
| 208 return 0; | 208 return 0; |
| 209 } | 209 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 | 246 |
| 247 IAMStreamConfig* streamConfig = NULL; | 247 IAMStreamConfig* streamConfig = NULL; |
| 248 AM_MEDIA_TYPE *pmt = NULL; | 248 AM_MEDIA_TYPE *pmt = NULL; |
| 249 VIDEO_STREAM_CONFIG_CAPS caps; | 249 VIDEO_STREAM_CONFIG_CAPS caps; |
| 250 | 250 |
| 251 HRESULT hr = _outputCapturePin->QueryInterface(IID_IAMStreamConfig, | 251 HRESULT hr = _outputCapturePin->QueryInterface(IID_IAMStreamConfig, |
| 252 (void**) &streamConfig); | 252 (void**) &streamConfig); |
| 253 if (hr) | 253 if (hr) |
| 254 { | 254 { |
| 255 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 255 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 256 "Can't get the Capture format settings."); | 256 "Can't get the Capture format settings."); |
| 257 return -1; | 257 return -1; |
| 258 } | 258 } |
| 259 | 259 |
| 260 //Get the windows capability from the capture device | 260 //Get the windows capability from the capture device |
| 261 bool isDVCamera = false; | 261 bool isDVCamera = false; |
| 262 hr = streamConfig->GetStreamCaps( | 262 hr = streamConfig->GetStreamCaps( |
| 263 windowsCapability.directShowCapabilityIndex, | 263 windowsCapability.directShowCapabilityIndex, |
| 264 &pmt, reinterpret_cast<BYTE*> (&caps)); | 264 &pmt, reinterpret_cast<BYTE*> (&caps)); |
| 265 if (!FAILED(hr)) | 265 if (!FAILED(hr)) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 296 //Check if this is a DV camera and we need to add MS DV Filter | 296 //Check if this is a DV camera and we need to add MS DV Filter |
| 297 if (pmt->subtype == MEDIASUBTYPE_dvsl | 297 if (pmt->subtype == MEDIASUBTYPE_dvsl |
| 298 || pmt->subtype == MEDIASUBTYPE_dvsd | 298 || pmt->subtype == MEDIASUBTYPE_dvsd |
| 299 || pmt->subtype == MEDIASUBTYPE_dvhd) | 299 || pmt->subtype == MEDIASUBTYPE_dvhd) |
| 300 isDVCamera = true; // This is a DV camera. Use MS DV filter | 300 isDVCamera = true; // This is a DV camera. Use MS DV filter |
| 301 } | 301 } |
| 302 RELEASE_AND_CLEAR(streamConfig); | 302 RELEASE_AND_CLEAR(streamConfig); |
| 303 | 303 |
| 304 if (FAILED(hr)) | 304 if (FAILED(hr)) |
| 305 { | 305 { |
| 306 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 306 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 307 "Failed to set capture device output format"); | 307 "Failed to set capture device output format"); |
| 308 return -1; | 308 return -1; |
| 309 } | 309 } |
| 310 | 310 |
| 311 if (isDVCamera) | 311 if (isDVCamera) |
| 312 { | 312 { |
| 313 hr = ConnectDVCamera(); | 313 hr = ConnectDVCamera(); |
| 314 } | 314 } |
| 315 else | 315 else |
| 316 { | 316 { |
| 317 hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputSendPin, | 317 hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputSendPin, |
| 318 NULL); | 318 NULL); |
| 319 } | 319 } |
| 320 if (hr != S_OK) | 320 if (hr != S_OK) |
| 321 { | 321 { |
| 322 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 322 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 323 "Failed to connect the Capture graph %d", hr); | 323 "Failed to connect the Capture graph %d", hr); |
| 324 return -1; | 324 return -1; |
| 325 } | 325 } |
| 326 return 0; | 326 return 0; |
| 327 } | 327 } |
| 328 | 328 |
| 329 int32_t VideoCaptureDS::DisconnectGraph() | 329 int32_t VideoCaptureDS::DisconnectGraph() |
| 330 { | 330 { |
| 331 HRESULT hr = _mediaControl->Stop(); | 331 HRESULT hr = _mediaControl->Stop(); |
| 332 hr += _graphBuilder->Disconnect(_outputCapturePin); | 332 hr += _graphBuilder->Disconnect(_outputCapturePin); |
| 333 hr += _graphBuilder->Disconnect(_inputSendPin); | 333 hr += _graphBuilder->Disconnect(_inputSendPin); |
| 334 | 334 |
| 335 //if the DV camera filter exist | 335 //if the DV camera filter exist |
| 336 if (_dvFilter) | 336 if (_dvFilter) |
| 337 { | 337 { |
| 338 _graphBuilder->Disconnect(_inputDvPin); | 338 _graphBuilder->Disconnect(_inputDvPin); |
| 339 _graphBuilder->Disconnect(_outputDvPin); | 339 _graphBuilder->Disconnect(_outputDvPin); |
| 340 } | 340 } |
| 341 if (hr != S_OK) | 341 if (hr != S_OK) |
| 342 { | 342 { |
| 343 WEBRTC_TRACE( webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 343 WEBRTC_TRACE( webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 344 "Failed to Stop the Capture device for reconfiguration %d", | 344 "Failed to Stop the Capture device for reconfiguration %d", |
| 345 hr); | 345 hr); |
| 346 return -1; | 346 return -1; |
| 347 } | 347 } |
| 348 return 0; | 348 return 0; |
| 349 } | 349 } |
| 350 HRESULT VideoCaptureDS::ConnectDVCamera() | 350 HRESULT VideoCaptureDS::ConnectDVCamera() |
| 351 { | 351 { |
| 352 HRESULT hr = S_OK; | 352 HRESULT hr = S_OK; |
| 353 | 353 |
| 354 if (!_dvFilter) | 354 if (!_dvFilter) |
| 355 { | 355 { |
| 356 hr = CoCreateInstance(CLSID_DVVideoCodec, NULL, CLSCTX_INPROC, | 356 hr = CoCreateInstance(CLSID_DVVideoCodec, NULL, CLSCTX_INPROC, |
| 357 IID_IBaseFilter, (void **) &_dvFilter); | 357 IID_IBaseFilter, (void **) &_dvFilter); |
| 358 if (hr != S_OK) | 358 if (hr != S_OK) |
| 359 { | 359 { |
| 360 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 360 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 361 "Failed to create the dv decoder: %x", hr); | 361 "Failed to create the dv decoder: %x", hr); |
| 362 return hr; | 362 return hr; |
| 363 } | 363 } |
| 364 hr = _graphBuilder->AddFilter(_dvFilter, L"VideoDecoderDV"); | 364 hr = _graphBuilder->AddFilter(_dvFilter, L"VideoDecoderDV"); |
| 365 if (hr != S_OK) | 365 if (hr != S_OK) |
| 366 { | 366 { |
| 367 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 367 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 368 "Failed to add the dv decoder to the graph: %x", hr); | 368 "Failed to add the dv decoder to the graph: %x", hr); |
| 369 return hr; | 369 return hr; |
| 370 } | 370 } |
| 371 _inputDvPin = GetInputPin(_dvFilter); | 371 _inputDvPin = GetInputPin(_dvFilter); |
| 372 if (_inputDvPin == NULL) | 372 if (_inputDvPin == NULL) |
| 373 { | 373 { |
| 374 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 374 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 375 "Failed to get input pin from DV decoder"); | 375 "Failed to get input pin from DV decoder"); |
| 376 return -1; | 376 return -1; |
| 377 } | 377 } |
| 378 _outputDvPin = GetOutputPin(_dvFilter, GUID_NULL); | 378 _outputDvPin = GetOutputPin(_dvFilter, GUID_NULL); |
| 379 if (_outputDvPin == NULL) | 379 if (_outputDvPin == NULL) |
| 380 { | 380 { |
| 381 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 381 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 382 "Failed to get output pin from DV decoder"); | 382 "Failed to get output pin from DV decoder"); |
| 383 return -1; | 383 return -1; |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputDvPin, NULL); | 386 hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputDvPin, NULL); |
| 387 if (hr != S_OK) | 387 if (hr != S_OK) |
| 388 { | 388 { |
| 389 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 389 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 390 "Failed to connect capture device to the dv devoder: %x", | 390 "Failed to connect capture device to the dv devoder: %x", |
| 391 hr); | 391 hr); |
| 392 return hr; | 392 return hr; |
| 393 } | 393 } |
| 394 | 394 |
| 395 hr = _graphBuilder->ConnectDirect(_outputDvPin, _inputSendPin, NULL); | 395 hr = _graphBuilder->ConnectDirect(_outputDvPin, _inputSendPin, NULL); |
| 396 if (hr != S_OK) | 396 if (hr != S_OK) |
| 397 { | 397 { |
| 398 if (hr == HRESULT_FROM_WIN32(ERROR_TOO_MANY_OPEN_FILES)) | 398 if (hr == HRESULT_FROM_WIN32(ERROR_TOO_MANY_OPEN_FILES)) |
| 399 { | 399 { |
| 400 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 400 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 401 "Failed to connect the capture device, busy"); | 401 "Failed to connect the capture device, busy"); |
| 402 } | 402 } |
| 403 else | 403 else |
| 404 { | 404 { |
| 405 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, | 405 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
| 406 "Failed to connect capture device to the send graph: 0x
%x", | 406 "Failed to connect capture device to the send graph: 0x
%x", |
| 407 hr); | 407 hr); |
| 408 } | 408 } |
| 409 return hr; | 409 return hr; |
| 410 } | 410 } |
| 411 return hr; | 411 return hr; |
| 412 } | 412 } |
| 413 } // namespace videocapturemodule | 413 } // namespace videocapturemodule |
| 414 } // namespace webrtc | 414 } // namespace webrtc |
| OLD | NEW |