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" | |
17 #include "webrtc/system_wrappers/include/trace.h" | 16 #include "webrtc/system_wrappers/include/trace.h" |
18 | 17 |
19 #include <Dvdmedia.h> // VIDEOINFOHEADER2 | 18 #include <Dvdmedia.h> // VIDEOINFOHEADER2 |
20 | 19 |
21 namespace webrtc | 20 namespace webrtc |
22 { | 21 { |
23 namespace videocapturemodule | 22 namespace videocapturemodule |
24 { | 23 { |
25 VideoCaptureDS::VideoCaptureDS() | 24 VideoCaptureDS::VideoCaptureDS() |
26 : _captureFilter(NULL), | 25 : _captureFilter(NULL), |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return -1; | 145 return -1; |
147 } | 146 } |
148 WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, 0, | 147 WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, 0, |
149 "Capture device '%s' initialized.", deviceUniqueIdUTF8); | 148 "Capture device '%s' initialized.", deviceUniqueIdUTF8); |
150 return 0; | 149 return 0; |
151 } | 150 } |
152 | 151 |
153 int32_t VideoCaptureDS::StartCapture( | 152 int32_t VideoCaptureDS::StartCapture( |
154 const VideoCaptureCapability& capability) | 153 const VideoCaptureCapability& capability) |
155 { | 154 { |
156 CriticalSectionScoped cs(&_apiCs); | 155 rtc::CritScope cs(&_apiCs); |
157 | 156 |
158 if (capability != _requestedCapability) | 157 if (capability != _requestedCapability) |
159 { | 158 { |
160 DisconnectGraph(); | 159 DisconnectGraph(); |
161 | 160 |
162 if (SetCameraOutput(capability) != 0) | 161 if (SetCameraOutput(capability) != 0) |
163 { | 162 { |
164 return -1; | 163 return -1; |
165 } | 164 } |
166 } | 165 } |
167 HRESULT hr = _mediaControl->Run(); | 166 HRESULT hr = _mediaControl->Run(); |
168 if (FAILED(hr)) | 167 if (FAILED(hr)) |
169 { | 168 { |
170 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, | 169 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
171 "Failed to start the Capture device."); | 170 "Failed to start the Capture device."); |
172 return -1; | 171 return -1; |
173 } | 172 } |
174 return 0; | 173 return 0; |
175 } | 174 } |
176 | 175 |
177 int32_t VideoCaptureDS::StopCapture() | 176 int32_t VideoCaptureDS::StopCapture() |
178 { | 177 { |
179 CriticalSectionScoped cs(&_apiCs); | 178 rtc::CritScope cs(&_apiCs); |
180 | 179 |
181 HRESULT hr = _mediaControl->Pause(); | 180 HRESULT hr = _mediaControl->Pause(); |
182 if (FAILED(hr)) | 181 if (FAILED(hr)) |
183 { | 182 { |
184 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, | 183 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
185 "Failed to stop the capture graph. %d", hr); | 184 "Failed to stop the capture graph. %d", hr); |
186 return -1; | 185 return -1; |
187 } | 186 } |
188 return 0; | 187 return 0; |
189 } | 188 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, | 402 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, |
404 "Failed to connect capture device to the send graph: 0x
%x", | 403 "Failed to connect capture device to the send graph: 0x
%x", |
405 hr); | 404 hr); |
406 } | 405 } |
407 return hr; | 406 return hr; |
408 } | 407 } |
409 return hr; | 408 return hr; |
410 } | 409 } |
411 } // namespace videocapturemodule | 410 } // namespace videocapturemodule |
412 } // namespace webrtc | 411 } // namespace webrtc |
OLD | NEW |