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

Unified Diff: media/filters/chunk_demuxer.h

Issue 794343003: Implement evictFrames() to support MSE's coded frame eviction algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: media/filters/chunk_demuxer.h
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index 6e8bdf95c7cde7cd6e767cf9c7b862f0ec0ec1fc..abb367da28490a9919085620a914914128d834bc 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -56,6 +56,13 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
void Remove(base::TimeDelta start, base::TimeDelta end,
base::TimeDelta duration);
+ // If the buffer is full, runs Frame Removal to try to free up space, as
+ // specified in the "Coded Frame Eviction Algorithm" in the Media Source
+ // Extensions Spec. Returns false iff buffer is still full after running
+ // eviction
+ // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
+ bool EvictFrames(DecodeTimestamp media_time);
+
// Signal to the stream that duration has changed to |duration|.
void OnSetDuration(base::TimeDelta duration);
@@ -163,6 +170,11 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
bool splice_frames_enabled);
~ChunkDemuxer() override;
+ // Set the media time provider.
+ // TODO(damienv): should truly be part of the constructor.
+ void SetMediaTimeProvider(
+ const base::Callback<base::TimeDelta(void)>& get_media_time_cb);
+
// Demuxer implementation.
void Initialize(DemuxerHost* host,
const PipelineStatusCB& cb,
@@ -242,6 +254,8 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
void Remove(const std::string& id, base::TimeDelta start,
base::TimeDelta end);
+ bool EvictFrames();
+
// Returns the current presentation duration.
double GetDuration();
double GetDuration_Locked();
@@ -376,6 +390,8 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
scoped_ptr<ChunkDemuxerStream> audio_;
scoped_ptr<ChunkDemuxerStream> video_;
+ base::Callback<base::TimeDelta(void)> get_media_time_cb_;
+
base::TimeDelta duration_;
// The duration passed to the last SetDuration(). If

Powered by Google App Engine
This is Rietveld 408576698