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

Unified Diff: media/filters/source_buffer_stream.h

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: rebase/resolve conflicts Created 3 years, 11 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/source_buffer_state.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 566477b81bd1120654d65221e9bd2885727aabd8..0a3f0236d6078dfd3a222b70cf9375a5560ec2d1 100644
--- a/media/filters/source_buffer_stream.h
+++ b/media/filters/source_buffer_stream.h
@@ -19,6 +19,7 @@
#include <vector>
#include "base/macros.h"
+#include "base/memory/memory_pressure_listener.h"
#include "base/memory/ref_counted.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/media_export.h"
@@ -93,6 +94,17 @@ class MEDIA_EXPORT SourceBufferStream {
bool GarbageCollectIfNeeded(DecodeTimestamp media_time,
size_t newDataSize);
+ // Gets invoked when the system is experiencing memory pressure, i.e. there's
+ // not enough free memory. The |media_time| is the media playback position at
+ // the time of memory pressure notification (needed for accurate GC). The
+ // |memory_pressure_listener| indicates memory pressure severity. The
+ // |force_instant_gc| is used to force the MSE garbage collection algorithm to
+ // be run right away, without waiting for the next append.
+ void OnMemoryPressure(
+ DecodeTimestamp media_time,
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level,
+ bool force_instant_gc);
+
// Changes the SourceBufferStream's state so that it will start returning
// buffers starting from the closest keyframe before |timestamp|.
void Seek(base::TimeDelta timestamp);
@@ -430,6 +442,9 @@ class MEDIA_EXPORT SourceBufferStream {
// Stores the largest distance between two adjacent buffers in this stream.
base::TimeDelta max_interbuffer_distance_;
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level_ =
+ base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
+
// The maximum amount of data in bytes the stream will keep in memory.
size_t memory_limit_;
« no previous file with comments | « media/filters/source_buffer_state.cc ('k') | media/filters/source_buffer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698