Remove redundant LastDecodedTimestamps.
The same information can be found in `AudioFrame.packet_infos_`.
Bug: none
Change-Id: Ib63bc41ffb896677a445d875afce0a98acea6999
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265161
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37153}
diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h
index 88c3af9..4c9c0b6 100644
--- a/api/neteq/neteq.h
+++ b/api/neteq/neteq.h
@@ -312,12 +312,6 @@
virtual std::vector<uint16_t> GetNackList(
int64_t round_trip_time_ms) const = 0;
- // Returns a vector containing the timestamps of the packets that were decoded
- // in the last GetAudio call. If no packets were decoded in the last call, the
- // vector is empty.
- // Mainly intended for testing.
- virtual std::vector<uint32_t> LastDecodedTimestamps() const = 0;
-
// Returns the length of the audio yet to play in the sync buffer.
// Mainly intended for testing.
virtual int SyncBufferSizeMs() const = 0;
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index d77acc0..1637ae7 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -476,11 +476,6 @@
return nack_->GetNackList(round_trip_time_ms);
}
-std::vector<uint32_t> NetEqImpl::LastDecodedTimestamps() const {
- MutexLock lock(&mutex_);
- return last_decoded_timestamps_;
-}
-
int NetEqImpl::SyncBufferSizeMs() const {
MutexLock lock(&mutex_);
return rtc::dchecked_cast<int>(sync_buffer_->FutureLength() /
@@ -779,7 +774,6 @@
Operation operation;
bool play_dtmf;
*muted = false;
- last_decoded_timestamps_.clear();
last_decoded_packet_infos_.clear();
tick_timer_->Increment();
stats_->IncreaseCounter(output_size_samples_, fs_hz_);
@@ -1464,7 +1458,6 @@
AudioDecoder* decoder,
int* decoded_length,
AudioDecoder::SpeechType* speech_type) {
- RTC_DCHECK(last_decoded_timestamps_.empty());
RTC_DCHECK(last_decoded_packet_infos_.empty());
// Do decoding.
@@ -1484,7 +1477,6 @@
auto opt_result = packet_list->front().frame->Decode(
rtc::ArrayView<int16_t>(&decoded_buffer_[*decoded_length],
decoded_buffer_length_ - *decoded_length));
- last_decoded_timestamps_.push_back(packet_list->front().timestamp);
last_decoded_packet_infos_.push_back(
std::move(packet_list->front().packet_info));
packet_list->pop_front();
diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h
index e2cd6c6..6120eab 100644
--- a/modules/audio_coding/neteq/neteq_impl.h
+++ b/modules/audio_coding/neteq/neteq_impl.h
@@ -194,8 +194,6 @@
std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const override;
- std::vector<uint32_t> LastDecodedTimestamps() const override;
-
int SyncBufferSizeMs() const override;
// This accessor method is only intended for testing purposes.
@@ -395,7 +393,6 @@
AudioFrame::kVadPassive;
std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_
RTC_GUARDED_BY(mutex_);
- std::vector<uint32_t> last_decoded_timestamps_ RTC_GUARDED_BY(mutex_);
std::vector<RtpPacketInfo> last_decoded_packet_infos_ RTC_GUARDED_BY(mutex_);
ExpandUmaLogger expand_uma_logger_ RTC_GUARDED_BY(mutex_);
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(mutex_);
diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc
index 43333c2..1ceb40c 100644
--- a/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_unittest.cc
@@ -842,67 +842,6 @@
EXPECT_FALSE(muted);
}
-TEST_F(NetEqDecodingTest, LastDecodedTimestampsEmpty) {
- EXPECT_TRUE(neteq_->LastDecodedTimestamps().empty());
-
- // Pull out data once.
- AudioFrame output;
- bool muted;
- ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
-
- EXPECT_TRUE(neteq_->LastDecodedTimestamps().empty());
-}
-
-TEST_F(NetEqDecodingTest, LastDecodedTimestampsOneDecoded) {
- // Insert one packet with PCM16b WB data (this is what PopulateRtpInfo does by
- // default). Make the length 10 ms.
- constexpr size_t kPayloadSamples = 16 * 10;
- constexpr size_t kPayloadBytes = 2 * kPayloadSamples;
- uint8_t payload[kPayloadBytes] = {0};
-
- RTPHeader rtp_info;
- constexpr uint32_t kRtpTimestamp = 0x1234;
- PopulateRtpInfo(0, kRtpTimestamp, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
-
- // Pull out data once.
- AudioFrame output;
- bool muted;
- ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
-
- EXPECT_EQ(std::vector<uint32_t>({kRtpTimestamp}),
- neteq_->LastDecodedTimestamps());
-
- // Nothing decoded on the second call.
- ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
- EXPECT_TRUE(neteq_->LastDecodedTimestamps().empty());
-}
-
-TEST_F(NetEqDecodingTest, LastDecodedTimestampsTwoDecoded) {
- // Insert two packets with PCM16b WB data (this is what PopulateRtpInfo does
- // by default). Make the length 5 ms so that NetEq must decode them both in
- // the same GetAudio call.
- constexpr size_t kPayloadSamples = 16 * 5;
- constexpr size_t kPayloadBytes = 2 * kPayloadSamples;
- uint8_t payload[kPayloadBytes] = {0};
-
- RTPHeader rtp_info;
- constexpr uint32_t kRtpTimestamp1 = 0x1234;
- PopulateRtpInfo(0, kRtpTimestamp1, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
- constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + kPayloadSamples;
- PopulateRtpInfo(1, kRtpTimestamp2, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
-
- // Pull out data once.
- AudioFrame output;
- bool muted;
- ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
-
- EXPECT_EQ(std::vector<uint32_t>({kRtpTimestamp1, kRtpTimestamp2}),
- neteq_->LastDecodedTimestamps());
-}
-
TEST_F(NetEqDecodingTest, TestConcealmentEvents) {
const int kNumConcealmentEvents = 19;
const size_t kSamples = 10 * 16;
diff --git a/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc b/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc
index eebdc78..bdb6fe9 100644
--- a/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc
+++ b/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc
@@ -102,12 +102,8 @@
bool /*muted*/,
NetEq* neteq) {
get_audio_time_ms_.push_back(time_now_ms);
- // Check what timestamps were decoded in the last GetAudio call.
- std::vector<uint32_t> dec_ts = neteq->LastDecodedTimestamps();
- // Find those timestamps in data_, insert their decoding time and sync
- // delay.
- for (uint32_t ts : dec_ts) {
- auto it = data_.find(ts);
+ for (const RtpPacketInfo& info : audio_frame.packet_infos_) {
+ auto it = data_.find(info.rtp_timestamp());
if (it == data_.end()) {
// This is a packet that was split out from another packet. Skip it.
continue;