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

Unified Diff: webrtc/media/base/videocapturer.h

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Removed AddSink 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/media/base/videocapturer.h
diff --git a/webrtc/media/base/videocapturer.h b/webrtc/media/base/videocapturer.h
index 3b0d05e86ec01aec08c37e4bcf92a945ee1f2d6c..746b418929b72680e132931f0b0cd3f2a81d10cd 100644
--- a/webrtc/media/base/videocapturer.h
+++ b/webrtc/media/base/videocapturer.h
@@ -19,6 +19,7 @@
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
+#include "webrtc/media/base/videosourceinterface.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/rollingaccumulator.h"
#include "webrtc/base/scoped_ptr.h"
@@ -27,6 +28,7 @@
#include "webrtc/base/timing.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/media/base/videoadapter.h"
+#include "webrtc/media/base/videobroadcaster.h"
#include "webrtc/media/base/videocommon.h"
#include "webrtc/media/base/videoframefactory.h"
#include "webrtc/media/devices/devicemanager.h"
@@ -73,7 +75,7 @@ struct CapturedFrame {
// time with nanosecond units.
uint32_t data_size; // number of bytes of the frame data
- webrtc::VideoRotation rotation; // rotation in degrees of the frame.
+ webrtc::VideoRotation rotation; // rotation in degrees of the frame.
void* data; // pointer to the frame data. This object allocates the
// memory or points to an existing memory.
@@ -108,9 +110,9 @@ struct CapturedFrame {
// media engine thread). Hence, the VideoCapture subclasses dont need to be
// thread safe.
//
-class VideoCapturer
- : public sigslot::has_slots<>,
- public rtc::MessageHandler {
+class VideoCapturer : public sigslot::has_slots<>,
+ public rtc::MessageHandler,
+ public rtc::VideoSourceInterface<cricket::VideoFrame> {
public:
// All signals are marshalled to |thread| or the creating thread if
// none is provided.
@@ -197,11 +199,6 @@ class VideoCapturer
return capture_state_;
}
- // Tells videocapturer whether to apply the pending rotation. By default, the
- // rotation is applied and the generated frame is up right. When set to false,
- // generated frames will carry the rotation information from
- // SetCaptureRotation. Return value indicates whether this operation succeeds.
- virtual bool SetApplyRotation(bool enable);
virtual bool GetApplyRotation() { return apply_rotation_; }
// Returns true if the capturer is screencasting. This can be used to
@@ -240,10 +237,6 @@ class VideoCapturer
// Signal the captured frame to downstream.
sigslot::signal2<VideoCapturer*, const CapturedFrame*,
sigslot::multi_threaded_local> SignalFrameCaptured;
- // Signal the captured and possibly adapted frame to downstream consumers
- // such as the encoder.
- sigslot::signal2<VideoCapturer*, const VideoFrame*,
- sigslot::multi_threaded_local> SignalVideoFrame;
// If true, run video adaptation. By default, video adaptation is enabled
// and users must call video_adapter()->OnOutputFormatRequest()
@@ -269,7 +262,16 @@ class VideoCapturer
VariableInfo<double>* frame_time_stats,
VideoFormat* last_captured_frame_format);
+ // Implements VideoSourceInterface
+ void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
+ const rtc::VideoWants& hints) override;
pthatcher1 2016/02/09 17:13:41 Should the type be VideoWants or VideoSinkWants?
perkj_webrtc 2016/02/10 10:54:36 Done.
+ void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override;
+
protected:
+ // OnSinkVideoWantsChanged can be overridden to change the default behavior
+ // when a sink changes its VideoWants by calling AddOrUpdateSink.
+ virtual void OnSinkVideoWantsChanged(const rtc::VideoWants& wants);
pthatcher1 2016/02/09 17:13:41 OnVideoSinkWantsChanged would be a better order, b
perkj_webrtc 2016/02/10 10:54:36 Done.
+
// Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
void OnFrameCaptured(VideoCapturer* video_capturer,
const CapturedFrame* captured_frame);
@@ -344,6 +346,7 @@ class VideoCapturer
bool muted_;
int black_frame_count_down_;
+ rtc::VideoBroadcaster broadcaster_;
bool enable_video_adapter_;
CoordinatedVideoAdapter video_adapter_;

Powered by Google App Engine
This is Rietveld 408576698