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_; |