Commit c9c6de7f authored by Aidan Wolter's avatar Aidan Wolter Committed by Commit Bot

Stop fetching 1s of data without delay

CAOS used to fetch the first 1s of data as quickly as possible and send
it to the audio decoder. This was causing the AudioRendererAlgorithm to
be unable to fill the entire buffer and AudioRendererMixerInput to fill
in the remaining section of the buffer with silence.

The user-facing experience is the first second of audio after a
resume/seek/skip could have dropouts.

To fix this, we remove this rapid-fetch logic, and fetch all data at the
same rate specified by the audio_params.

Bug: b/116860605
Test: pause/wait for CAOS close/resume 30+ times without reproducing.
Change-Id: I00e479f5413d9c737d55839ce5017498a096ffae
Reviewed-on: https://chromium-review.googlesource.com/c/1295229Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Commit-Queue: Aidan Wolter <awolter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601783}
parent cc040ea3
......@@ -50,7 +50,6 @@
namespace {
const int64_t kInvalidTimestamp = std::numeric_limits<int64_t>::min();
const int kMaxQueuedDataMs = 1000;
// Below are settings for MixerService and the DirectAudio it uses.
constexpr base::TimeDelta kFadeTime = base::TimeDelta::FromMilliseconds(5);
constexpr base::TimeDelta kMixerStartThreshold =
......@@ -314,14 +313,11 @@ void CastAudioOutputStream::CmaWrapper::OnPushBufferComplete(
return;
}
// Schedule next push buffer. We don't want to allow more than
// kMaxQueuedDataMs of queued audio.
// Schedule next push buffer.
const base::TimeTicks now = base::TimeTicks::Now();
next_push_time_ = std::max(now, next_push_time_ + buffer_duration_);
base::TimeDelta delay = (next_push_time_ - now) -
base::TimeDelta::FromMilliseconds(kMaxQueuedDataMs);
delay = std::max(delay, base::TimeDelta());
base::TimeDelta delay = next_push_time_ - now;
push_timer_.Start(FROM_HERE, delay, this, &CmaWrapper::PushBuffer);
push_in_progress_ = true;
}
......
......@@ -699,6 +699,8 @@ TEST_F(CastAudioOutputStreamTest, DeviceBusy) {
// Unblock the pipeline and verify that PushFrame resumes.
audio_decoder->set_pipeline_status(FakeAudioDecoder::PIPELINE_STATUS_OK);
base::TimeDelta duration = GetAudioParams().GetBufferDuration() * 2;
scoped_task_environment_.FastForwardBy(duration);
scoped_task_environment_.RunUntilIdle();
EXPECT_LT(1u, audio_decoder->pushed_buffer_count());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment