OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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/media/engine/webrtcvideocapturer.h" | 11 #include "webrtc/media/engine/webrtcvideocapturer.h" |
12 | 12 |
13 #include "webrtc/base/arraysize.h" | 13 #include "webrtc/base/arraysize.h" |
14 #include "webrtc/base/bind.h" | 14 #include "webrtc/base/bind.h" |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 #include "webrtc/base/safe_conversions.h" | 18 #include "webrtc/base/safe_conversions.h" |
19 #include "webrtc/base/thread.h" | 19 #include "webrtc/base/thread.h" |
20 #include "webrtc/base/timeutils.h" | 20 #include "webrtc/base/timeutils.h" |
21 #include "webrtc/media/engine/webrtcvideoframe.h" | 21 #include "webrtc/media/engine/webrtcvideoframe.h" |
| 22 #include "webrtc/media/engine/webrtcvideoframefactory.h" |
22 | 23 |
23 #include "webrtc/base/win32.h" // Need this to #include the impl files. | 24 #include "webrtc/base/win32.h" // Need this to #include the impl files. |
24 #include "webrtc/modules/video_capture/video_capture_factory.h" | 25 #include "webrtc/modules/video_capture/video_capture_factory.h" |
25 #include "webrtc/system_wrappers/include/field_trial.h" | 26 #include "webrtc/system_wrappers/include/field_trial.h" |
26 | 27 |
27 namespace cricket { | 28 namespace cricket { |
28 | 29 |
29 struct kVideoFourCCEntry { | 30 struct kVideoFourCCEntry { |
30 uint32_t fourcc; | 31 uint32_t fourcc; |
31 webrtc::RawVideoType webrtc_type; | 32 webrtc::RawVideoType webrtc_type; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 /////////////////////////////////////////////////////////////////////////// | 107 /////////////////////////////////////////////////////////////////////////// |
107 // Implementation of class WebRtcVideoCapturer | 108 // Implementation of class WebRtcVideoCapturer |
108 /////////////////////////////////////////////////////////////////////////// | 109 /////////////////////////////////////////////////////////////////////////// |
109 | 110 |
110 WebRtcVideoCapturer::WebRtcVideoCapturer() | 111 WebRtcVideoCapturer::WebRtcVideoCapturer() |
111 : factory_(new WebRtcVcmFactory), | 112 : factory_(new WebRtcVcmFactory), |
112 module_(nullptr), | 113 module_(nullptr), |
113 captured_frames_(0), | 114 captured_frames_(0), |
114 start_thread_(nullptr), | 115 start_thread_(nullptr), |
115 async_invoker_(nullptr) {} | 116 async_invoker_(nullptr) { |
| 117 set_frame_factory(new WebRtcVideoFrameFactory()); |
| 118 } |
116 | 119 |
117 WebRtcVideoCapturer::WebRtcVideoCapturer(WebRtcVcmFactoryInterface* factory) | 120 WebRtcVideoCapturer::WebRtcVideoCapturer(WebRtcVcmFactoryInterface* factory) |
118 : factory_(factory), | 121 : factory_(factory), |
119 module_(nullptr), | 122 module_(nullptr), |
120 captured_frames_(0), | 123 captured_frames_(0), |
121 start_thread_(nullptr), | 124 start_thread_(nullptr), |
122 async_invoker_(nullptr) {} | 125 async_invoker_(nullptr) { |
| 126 set_frame_factory(new WebRtcVideoFrameFactory()); |
| 127 } |
123 | 128 |
124 WebRtcVideoCapturer::~WebRtcVideoCapturer() {} | 129 WebRtcVideoCapturer::~WebRtcVideoCapturer() {} |
125 | 130 |
126 bool WebRtcVideoCapturer::Init(const Device& device) { | 131 bool WebRtcVideoCapturer::Init(const Device& device) { |
127 RTC_DCHECK(!start_thread_); | 132 RTC_DCHECK(!start_thread_); |
128 if (module_) { | 133 if (module_) { |
129 LOG(LS_ERROR) << "The capturer is already initialized"; | 134 LOG(LS_ERROR) << "The capturer is already initialized"; |
130 return false; | 135 return false; |
131 } | 136 } |
132 | 137 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 sample.render_time_ms() * rtc::kNumMicrosecsPerMillisec, 0), | 363 sample.render_time_ms() * rtc::kNumMicrosecsPerMillisec, 0), |
359 sample.width(), sample.height()); | 364 sample.width(), sample.height()); |
360 } | 365 } |
361 | 366 |
362 void WebRtcVideoCapturer::OnCaptureDelayChanged(const int32_t id, | 367 void WebRtcVideoCapturer::OnCaptureDelayChanged(const int32_t id, |
363 const int32_t delay) { | 368 const int32_t delay) { |
364 LOG(LS_INFO) << "Capture delay changed to " << delay << " ms"; | 369 LOG(LS_INFO) << "Capture delay changed to " << delay << " ms"; |
365 } | 370 } |
366 | 371 |
367 } // namespace cricket | 372 } // namespace cricket |
OLD | NEW |