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

Unified Diff: media/filters/source_buffer_stream.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/source_buffer_stream.h
diff --git a/media/filters/source_buffer_stream.h b/media/filters/source_buffer_stream.h
index 31b3f33475e208afd25140b8241b5a8078eb8b7e..0e11188b5ee1d1c29e60503536ceb2bfe4234928 100644
--- a/media/filters/source_buffer_stream.h
+++ b/media/filters/source_buffer_stream.h
@@ -90,6 +90,11 @@ class MEDIA_EXPORT SourceBufferStream {
void Remove(base::TimeDelta start, base::TimeDelta end,
base::TimeDelta duration);
+ // Frees up space if the SourceBufferStream is taking up too much memory.
+ // |media_time| is current playback position.
+ bool GarbageCollectIfNeeded(DecodeTimestamp media_time,
+ size_t newDataSize);
+
// Changes the SourceBufferStream's state so that it will start returning
// buffers starting from the closest keyframe before |timestamp|.
void Seek(base::TimeDelta timestamp);
@@ -120,6 +125,9 @@ class MEDIA_EXPORT SourceBufferStream {
// then base::TimeDelta() is returned.
base::TimeDelta GetBufferedDuration() const;
+ // Returns the size of the buffered data in bytes.
+ size_t GetBufferedSize() const;
+
// Notifies this object that end of stream has been signalled.
void MarkEndOfStream();
@@ -150,19 +158,20 @@ class MEDIA_EXPORT SourceBufferStream {
private:
friend class SourceBufferStreamTest;
- // Frees up space if the SourceBufferStream is taking up too much memory.
- void GarbageCollectIfNeeded();
-
// 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.
- size_t FreeBuffers(size_t total_bytes_to_free, bool reverse_direction);
+ // is true. |media_time| is current playback position.
+ // Returns the number of bytes freed.
+ size_t FreeBuffers(size_t total_bytes_to_free,
+ DecodeTimestamp media_time,
+ bool reverse_direction);
// Attempts to delete approximately |total_bytes_to_free| amount of data from
// |ranges_|, starting after the last appended buffer before the current
- // playback position.
- size_t FreeBuffersAfterLastAppended(size_t total_bytes_to_free);
+ // playback position |media_time|.
+ size_t FreeBuffersAfterLastAppended(size_t total_bytes_to_free,
+ DecodeTimestamp media_time);
// Gets the removal range to secure |byte_to_free| from
// [|start_timestamp|, |end_timestamp|).

Powered by Google App Engine
This is Rietveld 408576698