Notify NetEqController during muted state.

During muted state NetEq shortcircuits a large part of the internals to
quickly return a buffer filled with zeros. It can be beneficial for the
controller to be aware that it is in muted state.

Bug: webrtc:11005
Change-Id: I5fe24b4a3704d953cbd68b5a24bbb7ef58b30be0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186760
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32330}
This commit is contained in:
Ivo Creusen
2020-10-06 17:29:09 +02:00
committed by Commit Bot
parent b1ae5ccd16
commit 43546869d6
3 changed files with 7 additions and 0 deletions

View File

@ -163,6 +163,10 @@ class NetEqController {
uint32_t main_timestamp,
int fs_hz) = 0;
// Notify the NetEqController that we are currently in muted state.
// TODO(ivoc): Make pure virtual when downstream is updated.
virtual void NotifyMutedState() {}
// Returns true if a peak was found.
virtual bool PeakFound() const = 0;

View File

@ -84,6 +84,8 @@ class DecisionLogic : public NetEqController {
void RegisterEmptyPacket() override { delay_manager_->RegisterEmptyPacket(); }
void NotifyMutedState() override {}
bool SetMaximumDelay(int delay_ms) override {
return delay_manager_->SetMaximumDelay(delay_ms);
}

View File

@ -857,6 +857,7 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame,
static_cast<uint32_t>(audio_frame->samples_per_channel_);
audio_frame->num_channels_ = sync_buffer_->Channels();
stats_->ExpandedNoiseSamples(output_size_samples_, false);
controller_->NotifyMutedState();
*muted = true;
return 0;
}