Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2839163002: NetEq: Add functionality to assist with delay analysis and tooling (Closed)
Patch Set: After first round of reviews Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 89bddeccf8eb99f65e961efd591c24263816acdb..e119d9439cfbb617f38dfe27c1a9773792f8664c 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -364,8 +364,14 @@ int NetEqImpl::SetTargetDelay() {
return kNotImplemented;
}
-int NetEqImpl::TargetDelay() {
- return kNotImplemented;
+int NetEqImpl::TargetDelayMs() {
+ rtc::CritScope lock(&crit_sect_);
+ RTC_DCHECK(delay_manager_.get());
+ // The value from TargetLevel() is in number of packets, represented in Q8.
+ const size_t target_delay_samples =
+ (delay_manager_->TargetLevel() * decoder_frame_length_) >> 8;
+ return static_cast<int>(target_delay_samples) /
+ rtc::CheckedDivExact(fs_hz_, 1000);
}
int NetEqImpl::CurrentDelayMs() const {
@@ -569,6 +575,17 @@ std::vector<uint16_t> NetEqImpl::GetNackList(int64_t round_trip_time_ms) const {
return nack_->GetNackList(round_trip_time_ms);
}
+std::vector<uint32_t> NetEqImpl::LastDecodedTimestamps() const {
+ rtc::CritScope lock(&crit_sect_);
+ return last_decoded_timestamps_;
+}
+
+int NetEqImpl::SyncBufferSizeMs() const {
+ rtc::CritScope lock(&crit_sect_);
+ return rtc::dchecked_cast<int>(sync_buffer_->FutureLength() /
+ rtc::CheckedDivExact(fs_hz_, 1000));
+}
+
const SyncBuffer* NetEqImpl::sync_buffer_for_test() const {
rtc::CritScope lock(&crit_sect_);
return sync_buffer_.get();
@@ -873,6 +890,7 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame, bool* muted) {
Operations operation;
bool play_dtmf;
*muted = false;
+ last_decoded_timestamps_.clear();
tick_timer_->Increment();
stats_.IncreaseCounter(output_size_samples_, fs_hz_);
@@ -1498,6 +1516,8 @@ int NetEqImpl::DecodeCng(AudioDecoder* decoder, int* decoded_length,
int NetEqImpl::DecodeLoop(PacketList* packet_list, const Operations& operation,
AudioDecoder* decoder, int* decoded_length,
AudioDecoder::SpeechType* speech_type) {
+ RTC_DCHECK(last_decoded_timestamps_.empty());
+
// Do decoding.
while (
!packet_list->empty() &&
@@ -1514,6 +1534,7 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, const Operations& operation,
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);
packet_list->pop_front();
if (opt_result) {
const auto& result = *opt_result;
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl.h ('k') | webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698