Commit bf1382f3 authored by Mina Almasry's avatar Mina Almasry Committed by Commit Bot

Fix MediaPipelineBackendForMixer::SetPlaybackRate

This was missed when switching from audio master AV sync to video master
AV sync.

When setting playback rate, we only set the rate of the master, and have
the AV sync detect that and adjust the follower.

TODO is to proactively tell AvSync that we changed the rate, so it
doesn't have to discover that on its own.

Bug: b/110230181, b/78193238
Test: On device
Change-Id: I734030a68e5d670ec2c35b966f931e687630458a
Reviewed-on: https://chromium-review.googlesource.com/1101997
Commit-Queue: Mina Almasry <almasrymina@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567854}
parent 40dc4360
...@@ -137,9 +137,27 @@ bool MediaPipelineBackendForMixer::Resume() { ...@@ -137,9 +137,27 @@ bool MediaPipelineBackendForMixer::Resume() {
} }
bool MediaPipelineBackendForMixer::SetPlaybackRate(float rate) { bool MediaPipelineBackendForMixer::SetPlaybackRate(float rate) {
if (audio_decoder_) { LOG(INFO) << __func__ << " rate=" << rate;
return audio_decoder_->SetPlaybackRate(rate);
// TODO(almasrymina); instead of depending on the AV sync code to figure out
// that the playback rate has changed, we should notify it that we changed
// the playback rate and have it take that into account immediately.
// b/110230181.
//
// If av_sync_ is available, only set the playback rate of the video master,
// and let av_sync_ handle syncing the audio to the video.
if (av_sync_) {
DCHECK(video_decoder_);
return video_decoder_->SetPlaybackRate(rate);
} }
// If there is no av_sync_, then we must manually set the playback rate of
// the audio decoder.
if (video_decoder_ && !video_decoder_->SetPlaybackRate(rate))
return false;
if (audio_decoder_ && !audio_decoder_->SetPlaybackRate(rate))
return false;
return true; return true;
} }
......
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