Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2099)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 2549263002: FFmpegDemuxer should fall back to disabled streams for seeking (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 093e4f539b13847a1f7f6beb0e140674af037f69..f2fcd112c8bb68dafaa0e677c33e954d2a3a13e9 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -1557,9 +1557,24 @@ FFmpegDemuxerStream* FFmpegDemuxer::FindPreferredStreamForSeeking(
}
// If we couldn't find any streams with the start time lower than |seek_time|
- // then use either video (if one exists) or any audio stream.
- return video_stream ? video_stream : static_cast<FFmpegDemuxerStream*>(
- GetStream(DemuxerStream::AUDIO));
+ // then use either video (if one exists) or any enabled audio stream.
+ if (video_stream)
+ return video_stream;
+
+ for (const auto& stream : streams_) {
+ if (stream && stream->type() == DemuxerStream::AUDIO && stream->enabled())
+ return stream.get();
+ }
+
+ // If there's no enabled audio/video streams, then just fall back to any
DaleCurtis 2016/12/05 23:11:27 Seems like instead this code should loop the whole
servolk 2016/12/06 00:36:05 I agree that it would be nice and more consistent
+ // non-null stream, even if it's disabled.
+ for (const auto& stream : streams_) {
+ if (stream)
+ return stream.get();
+ }
+
+ NOTREACHED();
+ return nullptr;
}
void FFmpegDemuxer::OnSeekFrameDone(int result) {
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698