Index: media/filters/chunk_demuxer.cc |
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc |
index 5e9f6795fa2ac81b00dce13d2b66c3d8cfc0408e..4480b27ad460704e171538519bd6b971fbc79765 100644 |
--- a/media/filters/chunk_demuxer.cc |
+++ b/media/filters/chunk_demuxer.cc |
@@ -15,6 +15,7 @@ |
#include "base/macros.h" |
#include "base/metrics/histogram_macros.h" |
#include "base/stl_util.h" |
+#include "base/strings/string_number_conversions.h" |
#include "media/base/audio_decoder_config.h" |
#include "media/base/bind_to_current_loop.h" |
#include "media/base/media_tracks.h" |
@@ -241,6 +242,14 @@ void ChunkDemuxerStream::Read(const ReadCB& read_cb) { |
DCHECK(read_cb_.is_null()); |
read_cb_ = BindToCurrentLoop(read_cb); |
+ |
+ if (!is_enabled_) { |
+ DVLOG(1) << "Read from disabled stream, returning EOS"; |
+ base::ResetAndReturn(&read_cb_).Run(kOk, |
+ StreamParserBuffer::CreateEOSBuffer()); |
+ return; |
+ } |
+ |
CompletePendingReadIfPossible_Locked(); |
} |
@@ -269,6 +278,28 @@ VideoRotation ChunkDemuxerStream::video_rotation() { |
return VIDEO_ROTATION_0; |
} |
+bool ChunkDemuxerStream::enabled() const { |
+ base::AutoLock auto_lock(lock_); |
+ return is_enabled_; |
+} |
+ |
+void ChunkDemuxerStream::set_enabled(bool enabled, base::TimeDelta timestamp) { |
+ base::AutoLock auto_lock(lock_); |
+ |
+ if (enabled == is_enabled_) |
+ return; |
+ |
+ is_enabled_ = enabled; |
+ if (enabled) { |
+ DCHECK(stream_); |
+ stream_->Seek(timestamp); |
+ } else if (!read_cb_.is_null()) { |
+ DVLOG(1) << "Read from disabled stream, returning EOS"; |
+ base::ResetAndReturn(&read_cb_).Run(kOk, |
+ StreamParserBuffer::CreateEOSBuffer()); |
+ } |
+} |
+ |
TextTrackConfig ChunkDemuxerStream::text_track_config() { |
CHECK_EQ(type_, TEXT); |
base::AutoLock auto_lock(lock_); |