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

Unified Diff: media/filters/source_buffer_stream.h

Issue 341083004: Introduce the playback time into the MSE garbage collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New flow to pass the media time to SourceBufferStream. Created 6 years, 6 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 | « media/filters/legacy_frame_processor.cc ('k') | media/filters/source_buffer_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer_stream.h
diff --git a/media/filters/source_buffer_stream.h b/media/filters/source_buffer_stream.h
index 95b2e0970b16ecbde8e60307e9bdc5d3e07625f8..877f667927c9af9646de53224eea09f5ac7117c9 100644
--- a/media/filters/source_buffer_stream.h
+++ b/media/filters/source_buffer_stream.h
@@ -74,7 +74,8 @@ class MEDIA_EXPORT SourceBufferStream {
// presentation order and are non-overlapping.
// Returns true if Append() was successful, false if |buffers| are not added.
// TODO(vrk): Implement garbage collection. (crbug.com/125070)
- bool Append(const BufferQueue& buffers);
+ bool Append(const BufferQueue& buffers,
+ base::TimeDelta media_time);
// Removes buffers between |start| and |end| according to the steps
// in the "Coded Frame Removal Algorithm" in the Media Source
@@ -86,6 +87,12 @@ class MEDIA_EXPORT SourceBufferStream {
void Remove(base::TimeDelta start, base::TimeDelta end,
base::TimeDelta duration);
+ // Update the playback time.
+ // This playback time is used to avoid garbage collecting buffers
+ // corresponding to the playback time:
+ // MSE spec - 2.4.4 SourceBuffer Monitoring.
+ void NotifyMediaTimeUpdate(base::TimeDelta media_time);
+
// Changes the SourceBufferStream's state so that it will start returning
// buffers starting from the closest keyframe before |timestamp|.
void Seek(base::TimeDelta timestamp);
@@ -149,13 +156,15 @@ class MEDIA_EXPORT SourceBufferStream {
typedef std::list<SourceBufferRange*> RangeList;
// Frees up space if the SourceBufferStream is taking up too much memory.
- void GarbageCollectIfNeeded();
+ void GarbageCollectIfNeeded(base::TimeDelta media_time);
// Attempts to delete approximately |total_bytes_to_free| amount of data
// |ranges_|, starting at the front of |ranges_| and moving linearly forward
// through the buffers. Deletes starting from the back if |reverse_direction|
// is true. Returns the number of bytes freed.
- int FreeBuffers(int total_bytes_to_free, bool reverse_direction);
+ int FreeBuffers(int total_bytes_to_free,
+ bool reverse_direction,
+ base::TimeDelta media_time);
// Attempts to delete approximately |total_bytes_to_free| amount of data from
// |ranges_|, starting after the last appended buffer before the current
@@ -368,6 +377,11 @@ class MEDIA_EXPORT SourceBufferStream {
// emptied.
SourceBufferRange* selected_range_;
+ // Current media time.
+ // This does not need to be very accurate as long as it represents a lower
+ // bound of the media time.
+ base::TimeDelta current_media_time_;
+
// Queue of the next buffers to be returned from calls to GetNextBuffer(). If
// |track_buffer_| is empty, return buffers from |selected_range_|.
BufferQueue track_buffer_;
« no previous file with comments | « media/filters/legacy_frame_processor.cc ('k') | media/filters/source_buffer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698