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}
diff --git a/api/neteq/neteq_controller.h b/api/neteq/neteq_controller.h index 3c52b39..499b999 100644 --- a/api/neteq/neteq_controller.h +++ b/api/neteq/neteq_controller.h
@@ -163,6 +163,10 @@ 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;
diff --git a/modules/audio_coding/neteq/decision_logic.h b/modules/audio_coding/neteq/decision_logic.h index 23af0c5..c3d82eb 100644 --- a/modules/audio_coding/neteq/decision_logic.h +++ b/modules/audio_coding/neteq/decision_logic.h
@@ -84,6 +84,8 @@ void RegisterEmptyPacket() override { delay_manager_->RegisterEmptyPacket(); } + void NotifyMutedState() override {} + bool SetMaximumDelay(int delay_ms) override { return delay_manager_->SetMaximumDelay(delay_ms); }
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc index 34cf7d9..61e4de6 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -857,6 +857,7 @@ 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; }