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}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
640b51eeae
commit
664e30ff57
@ -312,12 +312,6 @@ class NetEq {
|
|||||||
virtual std::vector<uint16_t> GetNackList(
|
virtual std::vector<uint16_t> GetNackList(
|
||||||
int64_t round_trip_time_ms) const = 0;
|
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.
|
// Returns the length of the audio yet to play in the sync buffer.
|
||||||
// Mainly intended for testing.
|
// Mainly intended for testing.
|
||||||
virtual int SyncBufferSizeMs() const = 0;
|
virtual int SyncBufferSizeMs() const = 0;
|
||||||
|
|||||||
@ -476,11 +476,6 @@ std::vector<uint16_t> NetEqImpl::GetNackList(int64_t round_trip_time_ms) const {
|
|||||||
return nack_->GetNackList(round_trip_time_ms);
|
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 {
|
int NetEqImpl::SyncBufferSizeMs() const {
|
||||||
MutexLock lock(&mutex_);
|
MutexLock lock(&mutex_);
|
||||||
return rtc::dchecked_cast<int>(sync_buffer_->FutureLength() /
|
return rtc::dchecked_cast<int>(sync_buffer_->FutureLength() /
|
||||||
@ -779,7 +774,6 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame,
|
|||||||
Operation operation;
|
Operation operation;
|
||||||
bool play_dtmf;
|
bool play_dtmf;
|
||||||
*muted = false;
|
*muted = false;
|
||||||
last_decoded_timestamps_.clear();
|
|
||||||
last_decoded_packet_infos_.clear();
|
last_decoded_packet_infos_.clear();
|
||||||
tick_timer_->Increment();
|
tick_timer_->Increment();
|
||||||
stats_->IncreaseCounter(output_size_samples_, fs_hz_);
|
stats_->IncreaseCounter(output_size_samples_, fs_hz_);
|
||||||
@ -1464,7 +1458,6 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list,
|
|||||||
AudioDecoder* decoder,
|
AudioDecoder* decoder,
|
||||||
int* decoded_length,
|
int* decoded_length,
|
||||||
AudioDecoder::SpeechType* speech_type) {
|
AudioDecoder::SpeechType* speech_type) {
|
||||||
RTC_DCHECK(last_decoded_timestamps_.empty());
|
|
||||||
RTC_DCHECK(last_decoded_packet_infos_.empty());
|
RTC_DCHECK(last_decoded_packet_infos_.empty());
|
||||||
|
|
||||||
// Do decoding.
|
// Do decoding.
|
||||||
@ -1484,7 +1477,6 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list,
|
|||||||
auto opt_result = packet_list->front().frame->Decode(
|
auto opt_result = packet_list->front().frame->Decode(
|
||||||
rtc::ArrayView<int16_t>(&decoded_buffer_[*decoded_length],
|
rtc::ArrayView<int16_t>(&decoded_buffer_[*decoded_length],
|
||||||
decoded_buffer_length_ - *decoded_length));
|
decoded_buffer_length_ - *decoded_length));
|
||||||
last_decoded_timestamps_.push_back(packet_list->front().timestamp);
|
|
||||||
last_decoded_packet_infos_.push_back(
|
last_decoded_packet_infos_.push_back(
|
||||||
std::move(packet_list->front().packet_info));
|
std::move(packet_list->front().packet_info));
|
||||||
packet_list->pop_front();
|
packet_list->pop_front();
|
||||||
|
|||||||
@ -194,8 +194,6 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
|
|
||||||
std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const override;
|
std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const override;
|
||||||
|
|
||||||
std::vector<uint32_t> LastDecodedTimestamps() const override;
|
|
||||||
|
|
||||||
int SyncBufferSizeMs() const override;
|
int SyncBufferSizeMs() const override;
|
||||||
|
|
||||||
// This accessor method is only intended for testing purposes.
|
// This accessor method is only intended for testing purposes.
|
||||||
@ -395,7 +393,6 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
AudioFrame::kVadPassive;
|
AudioFrame::kVadPassive;
|
||||||
std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_
|
std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_
|
||||||
RTC_GUARDED_BY(mutex_);
|
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_);
|
std::vector<RtpPacketInfo> last_decoded_packet_infos_ RTC_GUARDED_BY(mutex_);
|
||||||
ExpandUmaLogger expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
ExpandUmaLogger expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
||||||
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(mutex_);
|
||||||
|
|||||||
@ -842,67 +842,6 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) {
|
|||||||
EXPECT_FALSE(muted);
|
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) {
|
TEST_F(NetEqDecodingTest, TestConcealmentEvents) {
|
||||||
const int kNumConcealmentEvents = 19;
|
const int kNumConcealmentEvents = 19;
|
||||||
const size_t kSamples = 10 * 16;
|
const size_t kSamples = 10 * 16;
|
||||||
|
|||||||
@ -102,12 +102,8 @@ void NetEqDelayAnalyzer::AfterGetAudio(int64_t time_now_ms,
|
|||||||
bool /*muted*/,
|
bool /*muted*/,
|
||||||
NetEq* neteq) {
|
NetEq* neteq) {
|
||||||
get_audio_time_ms_.push_back(time_now_ms);
|
get_audio_time_ms_.push_back(time_now_ms);
|
||||||
// Check what timestamps were decoded in the last GetAudio call.
|
for (const RtpPacketInfo& info : audio_frame.packet_infos_) {
|
||||||
std::vector<uint32_t> dec_ts = neteq->LastDecodedTimestamps();
|
auto it = data_.find(info.rtp_timestamp());
|
||||||
// Find those timestamps in data_, insert their decoding time and sync
|
|
||||||
// delay.
|
|
||||||
for (uint32_t ts : dec_ts) {
|
|
||||||
auto it = data_.find(ts);
|
|
||||||
if (it == data_.end()) {
|
if (it == data_.end()) {
|
||||||
// This is a packet that was split out from another packet. Skip it.
|
// This is a packet that was split out from another packet. Skip it.
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user