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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 2737653002: Buffer 2 seconds of data in the ffmpeg demuxer. (Closed)
Patch Set: UnmarkEndOfStream -> UnmarkEndOfStreamAndClearError Created 3 years, 9 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 ac79358c49f7d2542f6979bc838418d696c587b4..22edbe7569190bddf4d6993efc83e98b52a9afcd 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -251,8 +251,9 @@ std::unique_ptr<FFmpegDemuxerStream> FFmpegDemuxerStream::Create(
demuxer, stream, std::move(audio_config), std::move(video_config)));
}
-static void UnmarkEndOfStream(AVFormatContext* format_context) {
+static void UnmarkEndOfStreamAndClearError(AVFormatContext* format_context) {
format_context->pb->eof_reached = 0;
+ format_context->pb->error = 0;
}
//
@@ -780,16 +781,9 @@ void FFmpegDemuxerStream::SatisfyPendingRead() {
}
bool FFmpegDemuxerStream::HasAvailableCapacity() {
- // TODO(scherkus): Remove this return and reenable time-based capacity
- // after our data sources support canceling/concurrent reads, see
- // http://crbug.com/165762 for details.
-#if 1
- return !read_cb_.is_null();
-#else
- // Try to have one second's worth of encoded data per stream.
- const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(1);
+ // Try to have two second's worth of encoded data per stream.
+ const base::TimeDelta kCapacity = base::TimeDelta::FromSeconds(2);
return buffer_queue_.IsEmpty() || buffer_queue_.Duration() < kCapacity;
-#endif
}
size_t FFmpegDemuxerStream::MemoryUsage() const {
@@ -935,7 +929,8 @@ void FFmpegDemuxer::AbortPendingReads() {
// Aborting the read may cause EOF to be marked, undo this.
blocking_task_runner_->PostTask(
- FROM_HERE, base::Bind(&UnmarkEndOfStream, glue_->format_context()));
+ FROM_HERE,
+ base::Bind(&UnmarkEndOfStreamAndClearError, glue_->format_context()));
pending_read_ = false;
// TODO(dalecurtis): We probably should report PIPELINE_ERROR_ABORT here
« 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