Introduce VideoFrame::id to keep track of frames inside application.
Also switch webrtc code from deprecated constructors to the builder API.
Change-Id: Ie325bf1e9b4ff1e413fef3431ced8ed9ff725107
Bug: webrtc:10138
Reviewed-on: https://webrtc-review.googlesource.com/c/114422
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26132}
diff --git a/api/video/video_frame.h b/api/video/video_frame.h
index cc61fee..728d818 100644
--- a/api/video/video_frame.h
+++ b/api/video/video_frame.h
@@ -41,8 +41,10 @@
Builder& set_rotation(VideoRotation rotation);
Builder& set_color_space(const ColorSpace& color_space);
Builder& set_color_space(const ColorSpace* color_space);
+ Builder& set_id(uint16_t id);
private:
+ uint16_t id_ = 0;
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
int64_t timestamp_us_ = 0;
uint32_t timestamp_rtp_ = 0;
@@ -75,6 +77,15 @@
// Get frame size in pixels.
uint32_t size() const;
+ // Get frame ID. Returns 0 if ID is not set. Not guarantee to be transferred
+ // from the sender to the receiver, but preserved on single side. The id
+ // should be propagated between all frame modifications during its lifetime
+ // from capturing to sending as encoded image. It is intended to be unique
+ // over a time window of a few minutes for peer connection, to which
+ // corresponding video stream belongs to.
+ uint16_t id() const { return id_; }
+ void set_id(uint16_t id) { id_ = id; }
+
// System monotonic clock, same timebase as rtc::TimeMicros().
int64_t timestamp_us() const { return timestamp_us_; }
void set_timestamp_us(int64_t timestamp_us) { timestamp_us_ = timestamp_us; }
@@ -138,13 +149,15 @@
}
private:
- VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
+ VideoFrame(uint16_t id,
+ const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
uint32_t timestamp_rtp,
int64_t ntp_time_ms,
VideoRotation rotation,
const absl::optional<ColorSpace>& color_space);
+ uint16_t id_;
// An opaque reference counted handle that stores the pixel data.
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
uint32_t timestamp_rtp_;