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

Side by Side Diff: talk/media/base/videocapturer.h

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding VideoSourceInterface and letting cricket::VideoCapturer implement it 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 23 matching lines...) Expand all
34 #include <string> 34 #include <string>
35 #include <vector> 35 #include <vector>
36 36
37 #include "talk/media/base/mediachannel.h" 37 #include "talk/media/base/mediachannel.h"
38 #include "talk/media/base/videoadapter.h" 38 #include "talk/media/base/videoadapter.h"
39 #include "talk/media/base/videocommon.h" 39 #include "talk/media/base/videocommon.h"
40 #include "talk/media/base/videoframefactory.h" 40 #include "talk/media/base/videoframefactory.h"
41 #include "talk/media/devices/devicemanager.h" 41 #include "talk/media/devices/devicemanager.h"
42 #include "webrtc/base/basictypes.h" 42 #include "webrtc/base/basictypes.h"
43 #include "webrtc/base/criticalsection.h" 43 #include "webrtc/base/criticalsection.h"
44 #include "webrtc/media/base/videosourceinterface.h"
44 #include "webrtc/base/messagehandler.h" 45 #include "webrtc/base/messagehandler.h"
45 #include "webrtc/base/rollingaccumulator.h" 46 #include "webrtc/base/rollingaccumulator.h"
46 #include "webrtc/base/scoped_ptr.h" 47 #include "webrtc/base/scoped_ptr.h"
47 #include "webrtc/base/sigslot.h" 48 #include "webrtc/base/sigslot.h"
48 #include "webrtc/base/thread.h" 49 #include "webrtc/base/thread.h"
49 #include "webrtc/base/timing.h" 50 #include "webrtc/base/timing.h"
50 51
51 52
52 namespace cricket { 53 namespace cricket {
53 54
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // GetCaptureFormat() optionally 121 // GetCaptureFormat() optionally
121 // Stop() 122 // Stop()
122 // 123 //
123 // Assumption: 124 // Assumption:
124 // The Start() and Stop() methods are called by a single thread (E.g., the 125 // The Start() and Stop() methods are called by a single thread (E.g., the
125 // media engine thread). Hence, the VideoCapture subclasses dont need to be 126 // media engine thread). Hence, the VideoCapture subclasses dont need to be
126 // thread safe. 127 // thread safe.
127 // 128 //
128 class VideoCapturer 129 class VideoCapturer
129 : public sigslot::has_slots<>, 130 : public sigslot::has_slots<>,
130 public rtc::MessageHandler { 131 public rtc::MessageHandler,
132 public rtc::VideoSourceBase<cricket::VideoFrame> {
131 public: 133 public:
132 // All signals are marshalled to |thread| or the creating thread if 134 // All signals are marshalled to |thread| or the creating thread if
133 // none is provided. 135 // none is provided.
134 VideoCapturer(); 136 VideoCapturer();
135 explicit VideoCapturer(rtc::Thread* thread); 137 explicit VideoCapturer(rtc::Thread* thread);
136 virtual ~VideoCapturer() {} 138 virtual ~VideoCapturer() {}
137 139
138 // Gets the id of the underlying device, which is available after the capturer 140 // Gets the id of the underlying device, which is available after the capturer
139 // is initialized. Can be used to determine if two capturers reference the 141 // is initialized. Can be used to determine if two capturers reference the
140 // same device. 142 // same device.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // Signal all capture state changes that are not a direct result of calling 252 // Signal all capture state changes that are not a direct result of calling
251 // Start(). 253 // Start().
252 sigslot::signal2<VideoCapturer*, CaptureState> SignalStateChange; 254 sigslot::signal2<VideoCapturer*, CaptureState> SignalStateChange;
253 // Frame callbacks are multithreaded to allow disconnect and connect to be 255 // Frame callbacks are multithreaded to allow disconnect and connect to be
254 // called concurrently. It also ensures that it is safe to call disconnect 256 // called concurrently. It also ensures that it is safe to call disconnect
255 // at any time which is needed since the signal may be called from an 257 // at any time which is needed since the signal may be called from an
256 // unmarshalled thread owned by the VideoCapturer. 258 // unmarshalled thread owned by the VideoCapturer.
257 // Signal the captured frame to downstream. 259 // Signal the captured frame to downstream.
258 sigslot::signal2<VideoCapturer*, const CapturedFrame*, 260 sigslot::signal2<VideoCapturer*, const CapturedFrame*,
259 sigslot::multi_threaded_local> SignalFrameCaptured; 261 sigslot::multi_threaded_local> SignalFrameCaptured;
262
260 // Signal the captured and possibly adapted frame to downstream consumers 263 // Signal the captured and possibly adapted frame to downstream consumers
261 // such as the encoder. 264 // such as the encoder.
262 sigslot::signal2<VideoCapturer*, const VideoFrame*, 265 sigslot::signal2<VideoCapturer*, const VideoFrame*,
263 sigslot::multi_threaded_local> SignalVideoFrame; 266 sigslot::multi_threaded_local> SignalVideoFrame;
264 267
265 // If true, run video adaptation. By default, video adaptation is enabled 268 // If true, run video adaptation. By default, video adaptation is enabled
266 // and users must call video_adapter()->OnOutputFormatRequest() 269 // and users must call video_adapter()->OnOutputFormatRequest()
267 // to receive frames. 270 // to receive frames.
268 bool enable_video_adapter() const { return enable_video_adapter_; } 271 bool enable_video_adapter() const { return enable_video_adapter_; }
269 void set_enable_video_adapter(bool enable_video_adapter) { 272 void set_enable_video_adapter(bool enable_video_adapter) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 379
377 // Whether capturer should apply rotation to the frame before signaling it. 380 // Whether capturer should apply rotation to the frame before signaling it.
378 bool apply_rotation_; 381 bool apply_rotation_;
379 382
380 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer); 383 RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
381 }; 384 };
382 385
383 } // namespace cricket 386 } // namespace cricket
384 387
385 #endif // TALK_MEDIA_BASE_VIDEOCAPTURER_H_ 388 #endif // TALK_MEDIA_BASE_VIDEOCAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698