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

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: Renderer should return kNoTimestamp when theres no time source yet. Created 5 years, 7 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 1ef8d263755e695e4f7f344eeb4bc039a2cb0e54..dd76bc210dd0b82e5ed6f6385ee08bc72d0886a0 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);
@@ -145,6 +152,8 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
typedef base::Closure InitSegmentReceivedCB;
+ typedef base::Callback<base::TimeDelta(void)> GetMediaTimeCB;
+
// |open_cb| Run when Initialize() is called to signal that the demuxer
// is ready to receive media data via AppenData().
// |encrypted_media_init_data_cb| Run when the demuxer determines that an
@@ -152,12 +161,15 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
// |enable_text| Process inband text tracks in the normal way when true,
// otherwise ignore them.
// |log_cb| Run when the demuxer needs to emit MediaLog messages.
+ // |get_media_time_cb| Should return current media playback time, which
+ // is used to ensure unconsumed data in not garbage collected.
wolenetz 2015/06/04 00:38:57 nit: s/in/is
servolk 2015/06/04 03:03:01 Done.
// |splice_frames_enabled| Indicates that it's okay to generate splice frames
// per the MSE specification. Renderers must understand DecoderBuffer's
// splice_timestamp() field.
ChunkDemuxer(const base::Closure& open_cb,
const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
const LogCB& log_cb,
+ const GetMediaTimeCB& get_media_time_cb,
const scoped_refptr<MediaLog>& media_log,
bool splice_frames_enabled);
~ChunkDemuxer() override;
@@ -241,6 +253,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();
@@ -362,6 +376,7 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
// Callback used to report log messages that can help the web developer
// figure out what is wrong with the content.
LogCB log_cb_;
+ GetMediaTimeCB get_media_time_cb_;
scoped_refptr<MediaLog> media_log_;
PipelineStatusCB init_cb_;

Powered by Google App Engine
This is Rietveld 408576698