aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalak Agarwal <agpalak@google.com>2023-02-06 13:43:46 +0100
committerWebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-08 11:05:47 +0000
commit617d89a385f2d65d017feb74c9499b3079c3d4dd (patch)
treef274bea437dff4b112531f599ebe278b02e0c929
parentcd3e1d0ac4c064ce35389de5763fe583b7260a70 (diff)
downloadwebrtc-617d89a385f2d65d017feb74c9499b3079c3d4dd.tar.gz
Add capture time as identifier in webrtc::VideoFrame
This will be used by third_party/blink/renderer/platform/peerconnection/webrtc_video_track_source.cc to provide capture_time_identifier_ms_ from media::VideoFrame. This identifier would then be passed to webrtc::EncodedFrame and webrtc::TransformableVideoSenderFrame (in the future CLs) to be used as an identifier for encoded frames. Bug: webrtc:14878 Change-Id: I1d8a27891323d86fdc2f014988a8da572df84119 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291805 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Palak Agarwal <agpalak@google.com> Cr-Commit-Position: refs/heads/main@{#39270}
-rw-r--r--api/video/video_frame.cc36
-rw-r--r--api/video/video_frame.h13
2 files changed, 36 insertions, 13 deletions
diff --git a/api/video/video_frame.cc b/api/video/video_frame.cc
index 130820a886..63b85214bb 100644
--- a/api/video/video_frame.cc
+++ b/api/video/video_frame.cc
@@ -163,9 +163,10 @@ VideoFrame::Builder::~Builder() = default;
VideoFrame VideoFrame::Builder::build() {
RTC_CHECK(video_frame_buffer_ != nullptr);
- return VideoFrame(id_, video_frame_buffer_, timestamp_us_, timestamp_rtp_,
- ntp_time_ms_, rotation_, color_space_, render_parameters_,
- update_rect_, packet_infos_);
+ return VideoFrame(id_, video_frame_buffer_, timestamp_us_,
+ capture_time_identifier_ms_, timestamp_rtp_, ntp_time_ms_,
+ rotation_, color_space_, render_parameters_, update_rect_,
+ packet_infos_);
}
VideoFrame::Builder& VideoFrame::Builder::set_video_frame_buffer(
@@ -186,6 +187,12 @@ VideoFrame::Builder& VideoFrame::Builder::set_timestamp_us(
return *this;
}
+VideoFrame::Builder& VideoFrame::Builder::set_capture_time_identifier_ms(
+ const absl::optional<int64_t>& capture_time_identifier_ms) {
+ capture_time_identifier_ms_ = capture_time_identifier_ms;
+ return *this;
+}
+
VideoFrame::Builder& VideoFrame::Builder::set_timestamp_rtp(
uint32_t timestamp_rtp) {
timestamp_rtp_ = timestamp_rtp;
@@ -253,21 +260,24 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
RTC_DCHECK(buffer);
}
-VideoFrame::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,
- const RenderParameters& render_parameters,
- const absl::optional<UpdateRect>& update_rect,
- RtpPacketInfos packet_infos)
+VideoFrame::VideoFrame(
+ uint16_t id,
+ const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
+ int64_t timestamp_us,
+ const absl::optional<int64_t>& capture_time_identifier_ms,
+ uint32_t timestamp_rtp,
+ int64_t ntp_time_ms,
+ VideoRotation rotation,
+ const absl::optional<ColorSpace>& color_space,
+ const RenderParameters& render_parameters,
+ const absl::optional<UpdateRect>& update_rect,
+ RtpPacketInfos packet_infos)
: id_(id),
video_frame_buffer_(buffer),
timestamp_rtp_(timestamp_rtp),
ntp_time_ms_(ntp_time_ms),
timestamp_us_(timestamp_us),
+ capture_time_identifier_ms_(capture_time_identifier_ms),
rotation_(rotation),
color_space_(color_space),
render_parameters_(render_parameters),
diff --git a/api/video/video_frame.h b/api/video/video_frame.h
index 086aad820f..95d1f3edf5 100644
--- a/api/video/video_frame.h
+++ b/api/video/video_frame.h
@@ -107,6 +107,8 @@ class RTC_EXPORT VideoFrame {
const rtc::scoped_refptr<VideoFrameBuffer>& buffer);
Builder& set_timestamp_ms(int64_t timestamp_ms);
Builder& set_timestamp_us(int64_t timestamp_us);
+ Builder& set_capture_time_identifier_ms(
+ const absl::optional<int64_t>& capture_time_identifier_ms);
Builder& set_timestamp_rtp(uint32_t timestamp_rtp);
Builder& set_ntp_time_ms(int64_t ntp_time_ms);
Builder& set_rotation(VideoRotation rotation);
@@ -120,6 +122,7 @@ class RTC_EXPORT VideoFrame {
uint16_t id_ = kNotSetId;
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
int64_t timestamp_us_ = 0;
+ absl::optional<int64_t> capture_time_identifier_ms_;
uint32_t timestamp_rtp_ = 0;
int64_t ntp_time_ms_ = 0;
VideoRotation rotation_ = kVideoRotation_0;
@@ -166,6 +169,14 @@ class RTC_EXPORT VideoFrame {
int64_t timestamp_us() const { return timestamp_us_; }
void set_timestamp_us(int64_t timestamp_us) { timestamp_us_ = timestamp_us; }
+ const absl::optional<int64_t>& capture_time_identifier_ms() const {
+ return capture_time_identifier_ms_;
+ }
+ void set_capture_time_identifier_ms(
+ const absl::optional<int64_t>& capture_time_identifier_ms) {
+ capture_time_identifier_ms_ = capture_time_identifier_ms;
+ }
+
// Set frame timestamp (90kHz).
void set_timestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
@@ -262,6 +273,7 @@ class RTC_EXPORT VideoFrame {
VideoFrame(uint16_t id,
const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
+ const absl::optional<int64_t>& capture_time_identifier_ms,
uint32_t timestamp_rtp,
int64_t ntp_time_ms,
VideoRotation rotation,
@@ -276,6 +288,7 @@ class RTC_EXPORT VideoFrame {
uint32_t timestamp_rtp_;
int64_t ntp_time_ms_;
int64_t timestamp_us_;
+ absl::optional<int64_t> capture_time_identifier_ms_;
VideoRotation rotation_;
absl::optional<ColorSpace> color_space_;
// Contains parameters that affect have the frame should be rendered.