Chromium Code Reviews| 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) { |