diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h index 88c3af960c..4c9c0b6c5a 100644 --- a/api/neteq/neteq.h +++ b/api/neteq/neteq.h @@ -312,12 +312,6 @@ class NetEq { virtual std::vector 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 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 d77acc04dd..1637ae79ee 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc @@ -476,11 +476,6 @@ std::vector NetEqImpl::GetNackList(int64_t round_trip_time_ms) const { return nack_->GetNackList(round_trip_time_ms); } -std::vector NetEqImpl::LastDecodedTimestamps() const { - MutexLock lock(&mutex_); - return last_decoded_timestamps_; -} - int NetEqImpl::SyncBufferSizeMs() const { MutexLock lock(&mutex_); return rtc::dchecked_cast(sync_buffer_->FutureLength() / @@ -779,7 +774,6 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame, 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 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, 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 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, auto opt_result = packet_list->front().frame->Decode( rtc::ArrayView(&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 e2cd6c6054..6120eab5b6 100644 --- a/modules/audio_coding/neteq/neteq_impl.h +++ b/modules/audio_coding/neteq/neteq_impl.h @@ -194,8 +194,6 @@ class NetEqImpl : public webrtc::NetEq { std::vector GetNackList(int64_t round_trip_time_ms) const override; - std::vector LastDecodedTimestamps() const override; - int SyncBufferSizeMs() const override; // This accessor method is only intended for testing purposes. @@ -395,7 +393,6 @@ class NetEqImpl : public webrtc::NetEq { AudioFrame::kVadPassive; std::unique_ptr generated_noise_stopwatch_ RTC_GUARDED_BY(mutex_); - std::vector last_decoded_timestamps_ RTC_GUARDED_BY(mutex_); std::vector 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 43333c2891..1ceb40c5cb 100644 --- a/modules/audio_coding/neteq/neteq_unittest.cc +++ b/modules/audio_coding/neteq/neteq_unittest.cc @@ -842,67 +842,6 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) { 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({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({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 eebdc789af..bdb6fe9a5b 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 @@ void NetEqDelayAnalyzer::AfterGetAudio(int64_t time_now_ms, 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 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;