| Index: media/filters/audio_file_reader.cc
|
| diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
|
| index a1f4575b2cffe0baf59c15fcbe599bbbb6ac382a..582ca9cdc7fbbde62cbefc4bea56a84563da4ebc 100644
|
| --- a/media/filters/audio_file_reader.cc
|
| +++ b/media/filters/audio_file_reader.cc
|
| @@ -35,7 +35,12 @@ AudioFileReader::~AudioFileReader() {
|
| bool AudioFileReader::Open() {
|
| if (!OpenDemuxer())
|
| return false;
|
| - return OpenDecoder();
|
| + if (!OpenDecoder())
|
| + return false;
|
| +
|
| + // If the duration is unknown, fail out; this API can not work with streams of
|
| + // unknown duration currently.
|
| + return glue_->format_context()->duration != AV_NOPTS_VALUE;
|
| }
|
|
|
| bool AudioFileReader::OpenDemuxer() {
|
| @@ -248,7 +253,7 @@ int AudioFileReader::Read(AudioBus* audio_bus) {
|
| base::TimeDelta AudioFileReader::GetDuration() const {
|
| const AVRational av_time_base = {1, AV_TIME_BASE};
|
|
|
| - // Estimated duration in micro seconds.
|
| + DCHECK_NE(glue_->format_context()->duration, AV_NOPTS_VALUE);
|
| base::CheckedNumeric<int64_t> estimated_duration_us =
|
| glue_->format_context()->duration;
|
|
|
|
|