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

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

Issue 2318953005: New helper class AdaptedVideoSource. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « webrtc/media/base/adaptedvideosource.cc ('k') | webrtc/media/base/videocapturer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/videocapturer.h
diff --git a/webrtc/media/base/videocapturer.h b/webrtc/media/base/videocapturer.h
index c9c96eeb1d299cb06eaad73c8d4734cfdc357eac..9aab5e26691023b51b4f05f224ef6dcf9a85b9a1 100644
--- a/webrtc/media/base/videocapturer.h
+++ b/webrtc/media/base/videocapturer.h
@@ -24,9 +24,7 @@
#include "webrtc/media/base/videosourceinterface.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread_checker.h"
-#include "webrtc/base/timestampaligner.h"
-#include "webrtc/media/base/videoadapter.h"
-#include "webrtc/media/base/videobroadcaster.h"
+#include "webrtc/media/base/adaptedvideosource.h"
#include "webrtc/media/base/videocommon.h"
#include "webrtc/media/base/videoframefactory.h"
@@ -203,10 +201,8 @@ class VideoCapturer : public sigslot::has_slots<>,
// If true, run video adaptation. By default, video adaptation is enabled
// and users must call video_adapter()->OnOutputFormatRequest()
// to receive frames.
- bool enable_video_adapter() const { return enable_video_adapter_; }
- void set_enable_video_adapter(bool enable_video_adapter) {
- enable_video_adapter_ = enable_video_adapter;
- }
+ bool enable_video_adapter() const;
+ void set_enable_video_adapter(bool enable_video_adapter);
// Takes ownership.
void set_frame_factory(VideoFrameFactory* frame_factory);
@@ -223,34 +219,6 @@ class VideoCapturer : public sigslot::has_slots<>,
// when a sink changes its VideoSinkWants by calling AddOrUpdateSink.
virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants);
- // Reports the appropriate frame size after adaptation. Returns true
- // if a frame is wanted. Returns false if there are no interested
- // sinks, or if the VideoAdapter decides to drop the frame.
-
- // This function also implements timestamp translation/filtering.
- // |camera_time_ns| is the camera's timestamp for the captured
- // frame; it is expected to have good accuracy, but it may use an
- // arbitrary epoch and a small possibly free-running with a frequency
- // slightly different from the system clock. |system_time_us| is the
- // monotonic system time (in the same scale as rtc::TimeMicros) when
- // the frame was captured; the application is expected to read the
- // system time as soon as possible after frame capture, but it may
- // suffer scheduling jitter or poor system clock resolution. The
- // output |translated_camera_time_us| is a combined timestamp,
- // taking advantage of the supposedly higher accuracy in the camera
- // timestamp, but using the same epoch and frequency as system time.
- bool AdaptFrame(int width,
- int height,
- int64_t camera_time_us,
- int64_t system_time_us,
- int* out_width,
- int* out_height,
- int* crop_width,
- int* crop_height,
- int* crop_x,
- int* crop_y,
- int64_t* translated_camera_time_us);
-
// Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
void OnFrameCaptured(VideoCapturer* video_capturer,
const CapturedFrame* captured_frame);
@@ -261,7 +229,7 @@ class VideoCapturer : public sigslot::has_slots<>,
// orig_width and orig_height are used only to produce stats.
void OnFrame(const VideoFrame& frame, int orig_width, int orig_height);
- VideoAdapter* video_adapter() { return &video_adapter_; }
+ VideoAdapter* video_adapter() { return adapted_source_.video_adapter(); }
void SetCaptureState(CaptureState state);
@@ -313,9 +281,7 @@ class VideoCapturer : public sigslot::has_slots<>,
int scaled_width_; // Current output size from ComputeScale.
int scaled_height_;
- rtc::VideoBroadcaster broadcaster_;
- bool enable_video_adapter_;
- VideoAdapter video_adapter_;
+ rtc::AdaptedVideoSource adapted_source_;
rtc::CriticalSection frame_stats_crit_;
// The captured frame size before potential adapation.
« no previous file with comments | « webrtc/media/base/adaptedvideosource.cc ('k') | webrtc/media/base/videocapturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698