From 57e5562c3fb1f553e7a5031a242b05ed4c66e983 Mon Sep 17 00:00:00 2001 From: Evan Shrubsole Date: Mon, 9 Jan 2023 13:41:24 +0000 Subject: [PATCH] [Unwrap] Use RtpTimestampUnwrapper in audio/channel_receive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:13982 Change-Id: I02ef68cdda97585a543a1430f19959b589e82002 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/288745 Commit-Queue: Evan Shrubsole Reviewed-by: Jakob Ivarsson‎ Auto-Submit: Evan Shrubsole Cr-Commit-Position: refs/heads/main@{#39070} --- audio/BUILD.gn | 1 + audio/channel_receive.cc | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/audio/BUILD.gn b/audio/BUILD.gn index a7baf4db2e..199061586b 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -97,6 +97,7 @@ rtc_library("audio") { "../rtc_base:rate_limiter", "../rtc_base:refcount", "../rtc_base:rtc_event", + "../rtc_base:rtc_numerics", "../rtc_base:rtc_task_queue", "../rtc_base:safe_conversions", "../rtc_base:safe_minmax", diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index 0562d66c78..f884e39aa7 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -44,6 +44,7 @@ #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_minmax.h" +#include "rtc_base/numerics/sequence_number_unwrapper.h" #include "rtc_base/race_checker.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" @@ -265,7 +266,7 @@ class ChannelReceive : public ChannelReceiveInterface, mutable Mutex ts_stats_lock_; - std::unique_ptr rtp_ts_wraparound_handler_; + webrtc::RtpTimestampUnwrapper rtp_ts_wraparound_handler_; // The rtp timestamp of the first played out audio frame. int64_t capture_start_rtp_time_stamp_; // The capture ntp time (in local timebase) of the first played out audio @@ -448,7 +449,7 @@ AudioMixer::Source::AudioFrameInfo ChannelReceive::GetAudioFrameWithInfo( // audio_frame.timestamp_ should be valid from now on. // Compute elapsed time. int64_t unwrap_timestamp = - rtp_ts_wraparound_handler_->Unwrap(audio_frame->timestamp_); + rtp_ts_wraparound_handler_.Unwrap(audio_frame->timestamp_); audio_frame->elapsed_time_ms_ = (unwrap_timestamp - capture_start_rtp_time_stamp_) / (GetRtpTimestampRateHz() / 1000); @@ -554,7 +555,6 @@ ChannelReceive::ChannelReceive( ntp_estimator_(clock), playout_timestamp_rtp_(0), playout_delay_ms_(0), - rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), capture_start_rtp_time_stamp_(-1), capture_start_ntp_time_ms_(-1), _audioDeviceModulePtr(audio_device_module),