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

Unified Diff: media/filters/chunk_demuxer.h

Issue 1008463002: Fix MSE GC, make it less aggressive, more spec-compliant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added overflow check to sanity checks and use CHECK instead of DCHECK Created 5 years, 4 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
Index: media/filters/chunk_demuxer.h
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index d5224c7e4ceb5d6334b763bec5b6f99b9598a53b..cf1676715d8a139653a9d9b9cd95ea20d71d2207 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -57,6 +57,12 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
void Remove(base::TimeDelta start, base::TimeDelta end,
base::TimeDelta duration);
+ // If the buffer is full, attempts 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 EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize);
+
// Signal to the stream that duration has changed to |duration|.
void OnSetDuration(base::TimeDelta duration);
@@ -67,6 +73,9 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
// Returns base::TimeDelta() if the stream has no buffered data.
base::TimeDelta GetBufferedDuration() const;
+ // Returns the size of the buffered data in bytes.
+ size_t GetBufferedSize() const;
+
// Signal to the stream that buffers handed in through subsequent calls to
// Append() belong to a media segment that starts at |start_timestamp|.
void OnNewMediaSegment(DecodeTimestamp start_timestamp);
@@ -244,6 +253,14 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
void Remove(const std::string& id, base::TimeDelta start,
base::TimeDelta end);
+ // If the buffer is full, attempts 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 EvictCodedFrames(const std::string& id,
+ base::TimeDelta currentMediaTime,
+ size_t newDataSize);
+
// Returns the current presentation duration.
double GetDuration();
double GetDuration_Locked();

Powered by Google App Engine
This is Rietveld 408576698