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

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

Issue 2017443003: Implement timestamp translation/filter in VideoCapturer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 7 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 329ba086b90dfe1139c6f83cdd41b291af38540f..f947eda1164691d8c9c2cfa5bcc6f7b73b0486d5 100644
--- a/webrtc/media/base/videocapturer.h
+++ b/webrtc/media/base/videocapturer.h
@@ -225,15 +225,20 @@ class VideoCapturer : public sigslot::has_slots<>,
// 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.
+ // |capture_time_ns| is the camera's timestamp, using an arbitrary
+ // offset and possibly slightly off frequency. |time_us| is the
+ // timestamp translated into the same scale as rtc::TimeMicros.
stefan-webrtc 2016/06/08 11:28:42 Comment on system_time_us to make it clear that it
nisse-webrtc 2016/06/09 10:02:58 I've expanded the comments here.
bool AdaptFrame(int width,
int height,
- int64_t capture_time_ns,
+ int64_t capture_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);
+ int* crop_y,
+ int64_t* time_us);
// Callback attached to SignalFrameCaptured where SignalVideoFrames is called.
void OnFrameCaptured(VideoCapturer* video_capturer,
@@ -284,6 +289,9 @@ class VideoCapturer : public sigslot::has_slots<>,
void UpdateInputSize(int width, int height);
+ // Update the estimated offset between camera time and system monotonic time.
+ void UpdateOffset(int64_t camera_time_us, int64_t system_time_us);
+
rtc::ThreadChecker thread_checker_;
std::string id_;
CaptureState capture_state_;
@@ -310,6 +318,11 @@ class VideoCapturer : public sigslot::has_slots<>,
// Whether capturer should apply rotation to the frame before signaling it.
bool apply_rotation_;
+ // State for the timestamp translation.
+ unsigned frames_seen_;
stefan-webrtc 2016/06/08 11:28:42 int
nisse-webrtc 2016/06/09 10:02:58 Done.
+ // Estimated offset between camera time and system monotonic time.
+ int64_t offset_us_;
+
RTC_DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
};

Powered by Google App Engine
This is Rietveld 408576698