Let NetEq reset the AudioFrame during muted state
In practice, this change will make AudioFrame::muted_ replicate the explicit muted variable, passed as a pointer to NetEq::GetAudio. BUG=webrtc:7944 Review-Url: https://codereview.webrtc.org/2965203002 Cr-Commit-Position: refs/heads/master@{#18914}
This commit is contained in:
parent
02569adfd4
commit
a44910787b
@ -200,6 +200,7 @@ int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) {
|
||||
RTC_DCHECK_EQ(
|
||||
audio_frame->sample_rate_hz_,
|
||||
rtc::dchecked_cast<int>(audio_frame->samples_per_channel_ * 100));
|
||||
RTC_DCHECK_EQ(*muted, audio_frame->muted());
|
||||
SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(),
|
||||
last_vad_activity_, audio_frame);
|
||||
last_vad_activity_ = audio_frame->vad_activity_;
|
||||
@ -830,6 +831,8 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame, bool* muted) {
|
||||
// Check for muted state.
|
||||
if (enable_muted_state_ && expand_->Muted() && packet_buffer_->Empty()) {
|
||||
RTC_DCHECK_EQ(last_mode_, kModeExpand);
|
||||
audio_frame->Reset();
|
||||
RTC_DCHECK(audio_frame->muted()); // Reset() should mute the frame.
|
||||
playout_timestamp_ += static_cast<uint32_t>(output_size_samples_);
|
||||
audio_frame->sample_rate_hz_ = fs_hz_;
|
||||
audio_frame->samples_per_channel_ = output_size_samples_;
|
||||
|
||||
@ -1336,6 +1336,7 @@ TEST_F(NetEqDecodingTestWithMutedState, MutedState) {
|
||||
EXPECT_FALSE(GetAudioReturnMuted());
|
||||
// Pull data until faded out.
|
||||
GetAudioUntilMuted();
|
||||
EXPECT_TRUE(out_frame_.muted());
|
||||
|
||||
// Verify that output audio is not written during muted mode. Other parameters
|
||||
// should be correct, though.
|
||||
@ -1347,6 +1348,7 @@ TEST_F(NetEqDecodingTestWithMutedState, MutedState) {
|
||||
bool muted;
|
||||
EXPECT_EQ(0, neteq_->GetAudio(&new_frame, &muted));
|
||||
EXPECT_TRUE(muted);
|
||||
EXPECT_TRUE(out_frame_.muted());
|
||||
for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; i++) {
|
||||
EXPECT_EQ(17, frame_data[i]);
|
||||
}
|
||||
@ -1362,6 +1364,7 @@ TEST_F(NetEqDecodingTestWithMutedState, MutedState) {
|
||||
// packet. Verify that normal operation resumes.
|
||||
InsertPacket(kSamples * counter_);
|
||||
GetAudioUntilNormal();
|
||||
EXPECT_FALSE(out_frame_.muted());
|
||||
|
||||
NetEqNetworkStatistics stats;
|
||||
EXPECT_EQ(0, neteq_->NetworkStatistics(&stats));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user