Report stats from ChannelReceive::GetAudioFrameWithInfo at 1Hz.

This is a change from the previous 100Hz frequency.
Also changing the  locks slightly in AcmReceiver so that grabbing the
neteq lock right after we've let it go, isn't necessary inside of
AcmReceiver::GetAudio and also to avoid grabbing the neteq lock while
holding the AcmReceiver lock.

Bug: webrtc:12868
Change-Id: If6ee35f3dca20eb5bdbc615123aa099ccecf57c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221371
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34258}
This commit is contained in:
Tommi
2021-06-09 19:30:41 +02:00
committed by WebRTC LUCI CQ
parent e2e046452a
commit 3cc68ec32e
7 changed files with 47 additions and 23 deletions

View File

@ -258,6 +258,7 @@ void SetAudioFrameActivityAndType(bool vad_enabled,
int NetEqImpl::GetAudio(AudioFrame* audio_frame,
bool* muted,
int* current_sample_rate_hz,
absl::optional<Operation> action_override) {
TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio");
MutexLock lock(&mutex_);
@ -296,6 +297,11 @@ int NetEqImpl::GetAudio(AudioFrame* audio_frame,
}
}
if (current_sample_rate_hz) {
*current_sample_rate_hz = delayed_last_output_sample_rate_hz_.value_or(
last_output_sample_rate_hz_);
}
return kOK;
}

View File

@ -133,6 +133,7 @@ class NetEqImpl : public webrtc::NetEq {
int GetAudio(
AudioFrame* audio_frame,
bool* muted,
int* current_sample_rate_hz = nullptr,
absl::optional<Operation> action_override = absl::nullopt) override;
void SetCodecs(const std::map<int, SdpAudioFormat>& codecs) override;

View File

@ -1066,7 +1066,7 @@ TEST_F(NetEqDecodingTestFaxMode, TestJitterBufferDelayWithAcceleration) {
expected_target_delay += neteq_->TargetDelayMs() * 2 * kSamples;
// We have two packets in the buffer and kAccelerate operation will
// extract 20 ms of data.
neteq_->GetAudio(&out_frame_, &muted, NetEq::Operation::kAccelerate);
neteq_->GetAudio(&out_frame_, &muted, nullptr, NetEq::Operation::kAccelerate);
// Check jitter buffer delay.
NetEqLifetimeStatistics stats = neteq_->GetLifetimeStatistics();

View File

@ -172,7 +172,7 @@ NetEqTest::SimulationStepResult NetEqTest::RunToNextGetAudio() {
}
AudioFrame out_frame;
bool muted;
int error = neteq_->GetAudio(&out_frame, &muted,
int error = neteq_->GetAudio(&out_frame, &muted, nullptr,
ActionToOperations(next_action_));
next_action_ = absl::nullopt;
RTC_CHECK(!muted) << "The code does not handle enable_muted_state";