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

Disable AV sync in non kModeSyncPts modes

In the ignore PTS modes, the frames will have no PTS or may have wrong
PTS, so we should disable AV sync which can't function without that.

BUG= b/109900155
TEST=Manual

Change-Id: Id3b762054638f41bbbb8df002ff1a12da533e258
Reviewed-on: https://chromium-review.googlesource.com/1092162Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Commit-Queue: Mina Almasry <almasrymina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566032}
parent 126c0fdf
......@@ -41,7 +41,7 @@ MediaPipelineBackendForMixer::CreateAudioDecoder() {
if (audio_decoder_)
return nullptr;
audio_decoder_ = std::make_unique<AudioDecoderForMixer>(this);
if (video_decoder_ && !av_sync_) {
if (video_decoder_ && !av_sync_ && !IsIgnorePtsMode()) {
av_sync_ = AvSync::Create(GetTaskRunner(), this);
}
return audio_decoder_.get();
......@@ -54,7 +54,7 @@ MediaPipelineBackendForMixer::CreateVideoDecoder() {
return nullptr;
video_decoder_ = VideoDecoderForMixer::Create(params_);
DCHECK(video_decoder_.get());
if (audio_decoder_ && !av_sync_) {
if (audio_decoder_ && !av_sync_ && !IsIgnorePtsMode()) {
av_sync_ = AvSync::Create(GetTaskRunner(), this);
}
return video_decoder_.get();
......@@ -74,7 +74,7 @@ bool MediaPipelineBackendForMixer::Initialize() {
bool MediaPipelineBackendForMixer::Start(int64_t start_pts) {
DCHECK_EQ(kStateInitialized, state_);
int64_t start_playback_timestamp_us = INT64_MIN;
if (params_.sync_type == MediaPipelineDeviceParams::kModeSyncPts) {
if (!IsIgnorePtsMode()) {
start_playback_timestamp_us =
MonotonicClockNow() + kSyncedPlaybackStartDelayUs;
}
......@@ -183,5 +183,12 @@ int64_t MediaPipelineBackendForMixer::MonotonicClockNow() const {
}
#endif
bool MediaPipelineBackendForMixer::IsIgnorePtsMode() const {
return params_.sync_type ==
MediaPipelineDeviceParams::MediaSyncType::kModeIgnorePts ||
params_.sync_type ==
MediaPipelineDeviceParams::MediaSyncType::kModeIgnorePtsAndVSync;
}
} // namespace media
} // namespace chromecast
......@@ -67,6 +67,8 @@ class MediaPipelineBackendForMixer : public MediaPipelineBackend {
};
State state_;
bool IsIgnorePtsMode() const;
const MediaPipelineDeviceParams params_;
std::unique_ptr<AvSync> av_sync_;
......
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