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

Unified Diff: media/filters/audio_file_reader.cc

Issue 2540373002: Merge M56: "Fail decodeAudioFileData() when duration is unknown." (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/audio_file_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | media/filters/audio_file_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698