| 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 22e71f7f1d8af82f80d3f46c38cf465c84da7f4e..77e245db9d0598d3f7b357c8bd8fb0e809c9f084 100644
|
| --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
|
| +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
|
| @@ -15,6 +15,7 @@
|
|
|
| #include <algorithm>
|
|
|
| +#include "webrtc/base/checks.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/base/safe_conversions.h"
|
| #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
| @@ -282,8 +283,20 @@ int NetEqImpl::TargetDelay() {
|
| return kNotImplemented;
|
| }
|
|
|
| -int NetEqImpl::CurrentDelay() {
|
| - return kNotImplemented;
|
| +int NetEqImpl::CurrentDelayMs() const {
|
| + CriticalSectionScoped lock(crit_sect_.get());
|
| + if (fs_hz_ == 0)
|
| + return 0;
|
| + // Sum up the samples in the packet buffer with the future length of the sync
|
| + // buffer, and divide the sum by the sample rate.
|
| + const size_t delay_samples =
|
| + packet_buffer_->NumSamplesInBuffer(decoder_database_.get(),
|
| + decoder_frame_length_) +
|
| + sync_buffer_->FutureLength();
|
| + // The division below will truncate.
|
| + const int delay_ms =
|
| + static_cast<int>(delay_samples) / rtc::CheckedDivExact(fs_hz_, 1000);
|
| + return delay_ms;
|
| }
|
|
|
| // Deprecated.
|
|
|