Chromium Code Reviews| Index: webrtc/media/engine/webrtcvideoframe.h |
| diff --git a/webrtc/media/engine/webrtcvideoframe.h b/webrtc/media/engine/webrtcvideoframe.h |
| index 0e1d8099bcae34b37fdfc9a658b8b2670df78b77..b52a9a9182ebe5178035470dccee951bb81bb8c0 100644 |
| --- a/webrtc/media/engine/webrtcvideoframe.h |
| +++ b/webrtc/media/engine/webrtcvideoframe.h |
| @@ -27,6 +27,13 @@ struct CapturedFrame; |
| class WebRtcVideoFrame : public VideoFrame { |
| public: |
| WebRtcVideoFrame(); |
| + |
| + // Preferred construction, with microsecond timestamp. |
| + WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
| + webrtc::VideoRotation rotation, |
| + int64_t timestamp_us); |
| + |
| + // TODO(nisse): Deprecate/delete. |
| WebRtcVideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
| int64_t time_stamp_ns, |
| webrtc::VideoRotation rotation); |
| @@ -47,8 +54,13 @@ class WebRtcVideoFrame : public VideoFrame { |
| int64_t time_stamp_ns, |
| webrtc::VideoRotation rotation); |
| + // The timestamp of the captured frame is expected to use the same |
| + // timescale and epoch as rtc::Time. |
| + // TODO(nisse): Consider adding a warning message, or even an |
| + // RTC_DCHECK, if the time is too far off. |
|
pbos-webrtc
2016/04/13 13:42:09
line break at 80
nisse-webrtc
2016/04/13 14:37:33
Done.
|
| bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
| + void InitToEmptyBuffer(int w, int h); |
| void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); |
| bool InitToBlack(int w, int h, int64_t time_stamp_ns); |
| @@ -69,10 +81,9 @@ class WebRtcVideoFrame : public VideoFrame { |
| rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() |
| const override; |
| - int64_t GetTimeStamp() const override { return time_stamp_ns_; } |
| - void SetTimeStamp(int64_t time_stamp_ns) override { |
| - time_stamp_ns_ = time_stamp_ns; |
| - } |
| + /* System monotonic clock */ |
| + int64_t timestamp_us() const override { return timestamp_us_; } |
| + void set_timestamp_us(int64_t time_us) { timestamp_us_ = time_us; }; |
| webrtc::VideoRotation rotation() const override { return rotation_; } |
| @@ -95,15 +106,15 @@ class WebRtcVideoFrame : public VideoFrame { |
| // |dh| is destination height, like |dw|, but must be a positive number. |
| // Returns whether the function succeeded or failed. |
| bool Reset(uint32_t format, |
| - int w, |
| - int h, |
| - int dw, |
| - int dh, |
| - uint8_t* sample, |
| - size_t sample_size, |
| - int64_t time_stamp_ns, |
| - webrtc::VideoRotation rotation, |
| - bool apply_rotation); |
| + int w, |
| + int h, |
| + int dw, |
| + int dh, |
| + uint8_t* sample, |
| + size_t sample_size, |
| + int64_t timestamp_us, |
| + webrtc::VideoRotation rotation, |
| + bool apply_rotation); |
| private: |
| VideoFrame* CreateEmptyFrame(int w, int h, |
| @@ -111,7 +122,7 @@ class WebRtcVideoFrame : public VideoFrame { |
| // An opaque reference counted handle that stores the pixel data. |
| rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; |
| - int64_t time_stamp_ns_; |
| + int64_t timestamp_us_; |
| webrtc::VideoRotation rotation_; |
| // This is mutable as the calculation is expensive but once calculated, it |