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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 6249013: Return 0 instead of AVERROR_EOF for reads at or past the end of a file. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 9 years, 11 months 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 17248c6c5ed46eb77ac32815dc8c118636dcc64a..413ff5af6f0287579d2df246486986dcd76bac69 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -336,11 +336,11 @@ int FFmpegDemuxer::Read(int size, uint8* data) {
if (read_has_failed_)
return AVERROR_IO;
- // If the read position exceeds the size of the data source. We should return
- // end-of-file directly.
+ // Even though FFmpeg defines AVERROR_EOF, it's not to be used with I/O
+ // routines. Instead return 0 for any read at or past EOF.
int64 file_size;
if (data_source_->GetSize(&file_size) && read_position_ >= file_size)
- return AVERROR_EOF;
+ return 0;
// Asynchronous read from data source.
data_source_->Read(read_position_, size, data,
« 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