From 2d508f10d382d1400d98b9a809e67a0d1f6fffd5 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 27 Sep 2023 18:13:04 +0200 Subject: [PATCH] Deprecate old names for EncodedImage::RtpTimestamp accessor and setter Replace remaining webrtc usage of the deprecated names. Bug: webrtc:9378 Change-Id: Ie5bd2d3eaf68316e7c827fc35c7c7d8e2eadeb9f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321584 Reviewed-by: Harald Alvestrand Auto-Submit: Danil Chapovalov Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#40824} --- api/video/encoded_image.h | 8 +++++--- modules/video_coding/encoded_frame.h | 4 ++-- modules/video_coding/generic_decoder_unittest.cc | 2 +- sdk/android/src/jni/video_decoder_wrapper.cc | 4 ++-- sdk/android/src/jni/video_encoder_wrapper.cc | 2 +- sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm | 4 ++-- .../e2e/analyzer/video/quality_analyzing_video_encoder.cc | 4 ++-- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/video/encoded_image.h b/api/video/encoded_image.h index a96ce6b8c6..0e40cfecf2 100644 --- a/api/video/encoded_image.h +++ b/api/video/encoded_image.h @@ -83,9 +83,11 @@ class RTC_EXPORT EncodedImage { void SetRtpTimestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; } uint32_t RtpTimestamp() const { return timestamp_rtp_; } - // TODO(bugs.webrtc.org/9378): Delete two functions below. - void SetTimestamp(uint32_t timestamp) { SetRtpTimestamp(timestamp); } - uint32_t Timestamp() const { return RtpTimestamp(); } + // TODO(bugs.webrtc.org/9378): Delete two functions below after 2023-10-12 + [[deprecated]] void SetTimestamp(uint32_t timestamp) { + SetRtpTimestamp(timestamp); + } + [[deprecated]] uint32_t Timestamp() const { return RtpTimestamp(); } void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms); diff --git a/modules/video_coding/encoded_frame.h b/modules/video_coding/encoded_frame.h index b8c9d14653..88e5490562 100644 --- a/modules/video_coding/encoded_frame.h +++ b/modules/video_coding/encoded_frame.h @@ -46,17 +46,17 @@ class RTC_EXPORT VCMEncodedFrame : public EncodedImage { using EncodedImage::GetEncodedData; using EncodedImage::NtpTimeMs; using EncodedImage::PacketInfos; + using EncodedImage::RtpTimestamp; using EncodedImage::set_size; using EncodedImage::SetColorSpace; using EncodedImage::SetEncodedData; using EncodedImage::SetPacketInfos; + using EncodedImage::SetRtpTimestamp; using EncodedImage::SetSpatialIndex; using EncodedImage::SetSpatialLayerFrameSize; - using EncodedImage::SetTimestamp; using EncodedImage::size; using EncodedImage::SpatialIndex; using EncodedImage::SpatialLayerFrameSize; - using EncodedImage::Timestamp; /** * Get render time in milliseconds diff --git a/modules/video_coding/generic_decoder_unittest.cc b/modules/video_coding/generic_decoder_unittest.cc index e8d1dad09f..d0f6d53744 100644 --- a/modules/video_coding/generic_decoder_unittest.cc +++ b/modules/video_coding/generic_decoder_unittest.cc @@ -108,7 +108,7 @@ TEST_F(GenericDecoderTest, FrameDroppedIfTooManyFramesInFlight) { decoder_.SetDelayedDecoding(10); for (int i = 0; i < kMaxFramesInFlight + 1; ++i) { EncodedFrame encoded_frame; - encoded_frame.SetTimestamp(90000 * i); + encoded_frame.SetRtpTimestamp(90000 * i); generic_decoder_.Decode(encoded_frame, clock_->CurrentTime()); } diff --git a/sdk/android/src/jni/video_decoder_wrapper.cc b/sdk/android/src/jni/video_decoder_wrapper.cc index 8c231c07fb..0c0358d8d6 100644 --- a/sdk/android/src/jni/video_decoder_wrapper.cc +++ b/sdk/android/src/jni/video_decoder_wrapper.cc @@ -100,12 +100,12 @@ int32_t VideoDecoderWrapper::Decode(const EncodedImage& image_param, EncodedImage input_image(image_param); // We use RTP timestamp for capture time because capture_time_ms_ is always 0. input_image.capture_time_ms_ = - input_image.Timestamp() / kNumRtpTicksPerMillisec; + input_image.RtpTimestamp() / kNumRtpTicksPerMillisec; FrameExtraInfo frame_extra_info; frame_extra_info.timestamp_ns = input_image.capture_time_ms_ * rtc::kNumNanosecsPerMillisec; - frame_extra_info.timestamp_rtp = input_image.Timestamp(); + frame_extra_info.timestamp_rtp = input_image.RtpTimestamp(); frame_extra_info.timestamp_ntp = input_image.ntp_time_ms_; frame_extra_info.qp = qp_parsing_enabled_ ? ParseQP(input_image) : absl::nullopt; diff --git a/sdk/android/src/jni/video_encoder_wrapper.cc b/sdk/android/src/jni/video_encoder_wrapper.cc index 6cd8acbb04..8458ba6c3e 100644 --- a/sdk/android/src/jni/video_encoder_wrapper.cc +++ b/sdk/android/src/jni/video_encoder_wrapper.cc @@ -305,7 +305,7 @@ void VideoEncoderWrapper::OnEncodedFrame( // CopyOnWriteBuffer. EncodedImage frame_copy = frame; - frame_copy.SetTimestamp(frame_extra_info.timestamp_rtp); + frame_copy.SetRtpTimestamp(frame_extra_info.timestamp_rtp); frame_copy.capture_time_ms_ = capture_time_ns / rtc::kNumNanosecsPerMillisec; if (frame_copy.qp_ < 0) diff --git a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm index 7f8ae739e0..c8936d3ad5 100644 --- a/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm +++ b/sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm @@ -83,7 +83,7 @@ class ObjCEncodedImageBuffer : public webrtc::EncodedImageBufferInterface { freeWhenDone:NO]; self.encodedWidth = rtc::dchecked_cast(encodedImage._encodedWidth); self.encodedHeight = rtc::dchecked_cast(encodedImage._encodedHeight); - self.timeStamp = encodedImage.Timestamp(); + self.timeStamp = encodedImage.RtpTimestamp(); self.captureTimeMs = encodedImage.capture_time_ms_; self.ntpTimeMs = encodedImage.ntp_time_ms_; self.flags = encodedImage.timing_.flags; @@ -111,7 +111,7 @@ class ObjCEncodedImageBuffer : public webrtc::EncodedImageBufferInterface { encodedImage.set_size(self.buffer.length); encodedImage._encodedWidth = rtc::dchecked_cast(self.encodedWidth); encodedImage._encodedHeight = rtc::dchecked_cast(self.encodedHeight); - encodedImage.SetTimestamp(self.timeStamp); + encodedImage.SetRtpTimestamp(self.timeStamp); encodedImage.capture_time_ms_ = self.captureTimeMs; encodedImage.ntp_time_ms_ = self.ntpTimeMs; encodedImage.timing_.flags = self.flags; diff --git a/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc b/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc index 7a2b3165d6..d7ef0b0c10 100644 --- a/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc +++ b/test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.cc @@ -252,7 +252,7 @@ EncodedImageCallback::Result QualityAnalyzingVideoEncoder::OnEncodedImage( std::pair timestamp_frame_id; while (!timestamp_to_frame_id_list_.empty()) { timestamp_frame_id = timestamp_to_frame_id_list_.front(); - if (timestamp_frame_id.first == encoded_image.Timestamp()) { + if (timestamp_frame_id.first == encoded_image.RtpTimestamp()) { break; } timestamp_to_frame_id_list_.pop_front(); @@ -271,7 +271,7 @@ EncodedImageCallback::Result QualityAnalyzingVideoEncoder::OnEncodedImage( // posting frame to it, but then call the callback for this frame. RTC_LOG(LS_ERROR) << "QualityAnalyzingVideoEncoder::OnEncodedImage: No " "frame id for encoded_image.Timestamp()=" - << encoded_image.Timestamp(); + << encoded_image.RtpTimestamp(); return EncodedImageCallback::Result( EncodedImageCallback::Result::Error::OK); }