Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: talk/media/base/capturemanager.cc

Issue 1594973006: New rtc::VideoSinkInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Workaround to not break chrome. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/media/base/capturemanager.h ('k') | talk/media/base/capturemanager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 12 matching lines...) Expand all
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "talk/media/base/capturemanager.h" 28 #include "talk/media/base/capturemanager.h"
29 29
30 #include <algorithm> 30 #include <algorithm>
31 31
32 #include "talk/media/base/videocapturer.h" 32 #include "talk/media/base/videocapturer.h"
33 #include "talk/media/base/videorenderer.h"
34 #include "webrtc/base/checks.h" 33 #include "webrtc/base/checks.h"
35 #include "webrtc/base/logging.h" 34 #include "webrtc/base/logging.h"
36 35
37 namespace cricket { 36 namespace cricket {
38 37
39 // CaptureManager helper class. 38 // CaptureManager helper class.
40 class VideoCapturerState { 39 class VideoCapturerState {
41 public: 40 public:
42 static const VideoFormatPod kDefaultCaptureFormat; 41 static const VideoFormatPod kDefaultCaptureFormat;
43 42
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // TODO(ryanpetrie): Support restart requests. Should this 279 // TODO(ryanpetrie): Support restart requests. Should this
281 // to-be-implemented logic be used for {Start,Stop}VideoCapture as well? 280 // to-be-implemented logic be used for {Start,Stop}VideoCapture as well?
282 break; 281 break;
283 default: 282 default:
284 LOG(LS_ERROR) << "Unknown/unimplemented RestartOption"; 283 LOG(LS_ERROR) << "Unknown/unimplemented RestartOption";
285 break; 284 break;
286 } 285 }
287 return true; 286 return true;
288 } 287 }
289 288
290 bool CaptureManager::AddVideoRenderer(VideoCapturer* video_capturer, 289 void CaptureManager::AddVideoSink(VideoCapturer* video_capturer,
291 VideoRenderer* video_renderer) { 290 rtc::VideoSinkInterface<VideoFrame>* sink) {
292 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 291 RTC_DCHECK(thread_checker_.CalledOnValidThread());
293 if (!video_capturer || !video_renderer) { 292 // TODO(nisse): Do we really need to tolerate NULL inputs?
294 return false; 293 if (!video_capturer || !sink) {
294 return;
295 } 295 }
296 CaptureRenderAdapter* adapter = GetAdapter(video_capturer); 296 CaptureRenderAdapter* adapter = GetAdapter(video_capturer);
297 if (!adapter) { 297 if (!adapter) {
298 return false; 298 return;
299 } 299 }
300 adapter->AddRenderer(video_renderer); 300 adapter->AddSink(sink);
301 return true;
302 } 301 }
303 302
304 bool CaptureManager::RemoveVideoRenderer(VideoCapturer* video_capturer, 303 void CaptureManager::RemoveVideoSink(
305 VideoRenderer* video_renderer) { 304 VideoCapturer* video_capturer,
305 rtc::VideoSinkInterface<VideoFrame>* sink) {
306 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 306 RTC_DCHECK(thread_checker_.CalledOnValidThread());
307 if (!video_capturer || !video_renderer) { 307 if (!video_capturer || !sink) {
308 return false; 308 return;
309 } 309 }
310 CaptureRenderAdapter* adapter = GetAdapter(video_capturer); 310 CaptureRenderAdapter* adapter = GetAdapter(video_capturer);
311 if (!adapter) { 311 if (!adapter) {
312 return false; 312 return;
313 } 313 }
314 adapter->RemoveRenderer(video_renderer); 314 adapter->RemoveSink(sink);
315 return true;
316 } 315 }
317 316
318 bool CaptureManager::IsCapturerRegistered(VideoCapturer* video_capturer) const { 317 bool CaptureManager::IsCapturerRegistered(VideoCapturer* video_capturer) const {
319 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 318 RTC_DCHECK(thread_checker_.CalledOnValidThread());
320 return GetCaptureState(video_capturer) != NULL; 319 return GetCaptureState(video_capturer) != NULL;
321 } 320 }
322 321
323 bool CaptureManager::RegisterVideoCapturer(VideoCapturer* video_capturer) { 322 bool CaptureManager::RegisterVideoCapturer(VideoCapturer* video_capturer) {
324 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 323 RTC_DCHECK(thread_checker_.CalledOnValidThread());
325 VideoCapturerState* capture_state = 324 VideoCapturerState* capture_state =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 VideoCapturer* video_capturer) const { 397 VideoCapturer* video_capturer) const {
399 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 398 RTC_DCHECK(thread_checker_.CalledOnValidThread());
400 VideoCapturerState* capture_state = GetCaptureState(video_capturer); 399 VideoCapturerState* capture_state = GetCaptureState(video_capturer);
401 if (!capture_state) { 400 if (!capture_state) {
402 return NULL; 401 return NULL;
403 } 402 }
404 return capture_state->adapter(); 403 return capture_state->adapter();
405 } 404 }
406 405
407 } // namespace cricket 406 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/base/capturemanager.h ('k') | talk/media/base/capturemanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698