From b57053ec21b62ab9469750f26d76158f187f7a65 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Mon, 20 Feb 2023 13:29:46 +0100 Subject: [PATCH] Use type webrtc::Timestamp as capture_time_identifier in VideoFrame Replace the existing variable capture_time_identifier_ms_ with capture_time_identifier_ in webrtc::VideoFrame and webrtc::VideoFrame::Builder. This variable uses webrtc::Timestamp as its type versus using int64_t which creates confusion about whether it is being recorded in milliseconds/microseconds. Change-Id: I0b83a6235fb1d5732f7afe2c14d7d6121f1e985b Bug: webrtc:14878 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293520 Reviewed-by: Harald Alvestrand Commit-Queue: Palak Agarwal Cr-Commit-Position: refs/heads/main@{#39369} --- api/video/video_frame.cc | 33 ++++++++++++++++----------------- api/video/video_frame.h | 20 ++++++++++---------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/api/video/video_frame.cc b/api/video/video_frame.cc index 63b85214bb..35dedce1b2 100644 --- a/api/video/video_frame.cc +++ b/api/video/video_frame.cc @@ -164,7 +164,7 @@ VideoFrame::Builder::~Builder() = default; VideoFrame VideoFrame::Builder::build() { RTC_CHECK(video_frame_buffer_ != nullptr); return VideoFrame(id_, video_frame_buffer_, timestamp_us_, - capture_time_identifier_ms_, timestamp_rtp_, ntp_time_ms_, + capture_time_identifier_, timestamp_rtp_, ntp_time_ms_, rotation_, color_space_, render_parameters_, update_rect_, packet_infos_); } @@ -187,9 +187,9 @@ VideoFrame::Builder& VideoFrame::Builder::set_timestamp_us( return *this; } -VideoFrame::Builder& VideoFrame::Builder::set_capture_time_identifier_ms( - const absl::optional& capture_time_identifier_ms) { - capture_time_identifier_ms_ = capture_time_identifier_ms; +VideoFrame::Builder& VideoFrame::Builder::set_capture_time_identifier( + const absl::optional& capture_time_identifier) { + capture_time_identifier_ = capture_time_identifier; return *this; } @@ -260,24 +260,23 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr& buffer, RTC_DCHECK(buffer); } -VideoFrame::VideoFrame( - uint16_t id, - const rtc::scoped_refptr& buffer, - int64_t timestamp_us, - const absl::optional& capture_time_identifier_ms, - uint32_t timestamp_rtp, - int64_t ntp_time_ms, - VideoRotation rotation, - const absl::optional& color_space, - const RenderParameters& render_parameters, - const absl::optional& update_rect, - RtpPacketInfos packet_infos) +VideoFrame::VideoFrame(uint16_t id, + const rtc::scoped_refptr& buffer, + int64_t timestamp_us, + const absl::optional& capture_time_identifier, + uint32_t timestamp_rtp, + int64_t ntp_time_ms, + VideoRotation rotation, + const absl::optional& color_space, + const RenderParameters& render_parameters, + const absl::optional& 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), + capture_time_identifier_(capture_time_identifier), 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 95d1f3edf5..a257a3209e 100644 --- a/api/video/video_frame.h +++ b/api/video/video_frame.h @@ -107,8 +107,8 @@ class RTC_EXPORT VideoFrame { const rtc::scoped_refptr& 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& capture_time_identifier_ms); + Builder& set_capture_time_identifier( + const absl::optional& capture_time_identifier); Builder& set_timestamp_rtp(uint32_t timestamp_rtp); Builder& set_ntp_time_ms(int64_t ntp_time_ms); Builder& set_rotation(VideoRotation rotation); @@ -122,7 +122,7 @@ class RTC_EXPORT VideoFrame { uint16_t id_ = kNotSetId; rtc::scoped_refptr video_frame_buffer_; int64_t timestamp_us_ = 0; - absl::optional capture_time_identifier_ms_; + absl::optional capture_time_identifier_; uint32_t timestamp_rtp_ = 0; int64_t ntp_time_ms_ = 0; VideoRotation rotation_ = kVideoRotation_0; @@ -169,12 +169,12 @@ 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& capture_time_identifier_ms() const { - return capture_time_identifier_ms_; + const absl::optional& capture_time_identifier() const { + return capture_time_identifier_; } - void set_capture_time_identifier_ms( - const absl::optional& capture_time_identifier_ms) { - capture_time_identifier_ms_ = capture_time_identifier_ms; + void set_capture_time_identifier( + const absl::optional& capture_time_identifier) { + capture_time_identifier_ = capture_time_identifier; } // Set frame timestamp (90kHz). @@ -273,7 +273,7 @@ class RTC_EXPORT VideoFrame { VideoFrame(uint16_t id, const rtc::scoped_refptr& buffer, int64_t timestamp_us, - const absl::optional& capture_time_identifier_ms, + const absl::optional& capture_time_identifier, uint32_t timestamp_rtp, int64_t ntp_time_ms, VideoRotation rotation, @@ -288,7 +288,7 @@ class RTC_EXPORT VideoFrame { uint32_t timestamp_rtp_; int64_t ntp_time_ms_; int64_t timestamp_us_; - absl::optional capture_time_identifier_ms_; + absl::optional capture_time_identifier_; VideoRotation rotation_; absl::optional color_space_; // Contains parameters that affect have the frame should be rendered.