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 <hta@webrtc.org>
Commit-Queue: Palak Agarwal <agpalak@google.com>
Cr-Commit-Position: refs/heads/main@{#39369}
This commit is contained in:
Palak Agarwal 2023-02-20 13:29:46 +01:00 committed by WebRTC LUCI CQ
parent 6aba07e5fe
commit b57053ec21
2 changed files with 26 additions and 27 deletions

View File

@ -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<int64_t>& capture_time_identifier_ms) {
capture_time_identifier_ms_ = capture_time_identifier_ms;
VideoFrame::Builder& VideoFrame::Builder::set_capture_time_identifier(
const absl::optional<Timestamp>& capture_time_identifier) {
capture_time_identifier_ = capture_time_identifier;
return *this;
}
@ -260,24 +260,23 @@ 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,
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)
VideoFrame::VideoFrame(uint16_t id,
const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
const absl::optional<Timestamp>& capture_time_identifier,
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),
capture_time_identifier_(capture_time_identifier),
rotation_(rotation),
color_space_(color_space),
render_parameters_(render_parameters),

View File

@ -107,8 +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_capture_time_identifier(
const absl::optional<Timestamp>& 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<webrtc::VideoFrameBuffer> video_frame_buffer_;
int64_t timestamp_us_ = 0;
absl::optional<int64_t> capture_time_identifier_ms_;
absl::optional<Timestamp> 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<int64_t>& capture_time_identifier_ms() const {
return capture_time_identifier_ms_;
const absl::optional<Timestamp>& capture_time_identifier() const {
return capture_time_identifier_;
}
void set_capture_time_identifier_ms(
const absl::optional<int64_t>& capture_time_identifier_ms) {
capture_time_identifier_ms_ = capture_time_identifier_ms;
void set_capture_time_identifier(
const absl::optional<Timestamp>& 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<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
const absl::optional<int64_t>& capture_time_identifier_ms,
const absl::optional<Timestamp>& 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<int64_t> capture_time_identifier_ms_;
absl::optional<Timestamp> capture_time_identifier_;
VideoRotation rotation_;
absl::optional<ColorSpace> color_space_;
// Contains parameters that affect have the frame should be rendered.