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

Side by Side Diff: media/filters/source_buffer_state.h

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: rebase/resolve conflicts Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/source_buffer_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_
6 #define MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ 6 #define MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/memory_pressure_listener.h"
12 #include "media/base/audio_codecs.h" 13 #include "media/base/audio_codecs.h"
13 #include "media/base/demuxer.h" 14 #include "media/base/demuxer.h"
14 #include "media/base/demuxer_stream.h" 15 #include "media/base/demuxer_stream.h"
15 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
16 #include "media/base/media_log.h" 17 #include "media/base/media_log.h"
17 #include "media/base/stream_parser.h" 18 #include "media/base/stream_parser.h"
18 #include "media/base/stream_parser_buffer.h" 19 #include "media/base/stream_parser_buffer.h"
19 #include "media/base/video_codecs.h" 20 #include "media/base/video_codecs.h"
20 21
21 namespace media { 22 namespace media {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Calls Remove(|start|, |end|, |duration|) on all 69 // Calls Remove(|start|, |end|, |duration|) on all
69 // ChunkDemuxerStreams managed by this object. 70 // ChunkDemuxerStreams managed by this object.
70 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration); 71 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration);
71 72
72 // If the buffer is full, attempts to try to free up space, as specified in 73 // If the buffer is full, attempts to try to free up space, as specified in
73 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. 74 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec.
74 // Returns false iff buffer is still full after running eviction. 75 // Returns false iff buffer is still full after running eviction.
75 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction 76 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
76 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize); 77 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize);
77 78
79 // Gets invoked when the system is experiencing memory pressure, i.e. there's
80 // not enough free memory. The |media_time| is the media playback position at
81 // the time of memory pressure notification (needed for accurate GC). The
82 // |memory_pressure_listener| indicates memory pressure severity. The
83 // |force_instant_gc| is used to force the MSE garbage collection algorithm to
84 // be run right away, without waiting for the next append.
85 void OnMemoryPressure(
86 DecodeTimestamp media_time,
87 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level,
88 bool force_instant_gc);
89
78 // Returns true if currently parsing a media segment, or false otherwise. 90 // Returns true if currently parsing a media segment, or false otherwise.
79 bool parsing_media_segment() const { return parsing_media_segment_; } 91 bool parsing_media_segment() const { return parsing_media_segment_; }
80 92
81 // Sets |frame_processor_|'s sequence mode to |sequence_mode|. 93 // Sets |frame_processor_|'s sequence mode to |sequence_mode|.
82 void SetSequenceMode(bool sequence_mode); 94 void SetSequenceMode(bool sequence_mode);
83 95
84 // Signals the coded frame processor to update its group start timestamp to be 96 // Signals the coded frame processor to update its group start timestamp to be
85 // |timestamp_offset| if it is in sequence append mode. 97 // |timestamp_offset| if it is in sequence append mode.
86 void SetGroupStartTimestampIfInSequenceMode(base::TimeDelta timestamp_offset); 98 void SetGroupStartTimestampIfInSequenceMode(base::TimeDelta timestamp_offset);
87 99
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // TODO(wolenetz): Refactor this function while integrating April 29, 2014 232 // TODO(wolenetz): Refactor this function while integrating April 29, 2014
221 // changes to MSE spec. See http://crbug.com/371499. 233 // changes to MSE spec. See http://crbug.com/371499.
222 bool auto_update_timestamp_offset_; 234 bool auto_update_timestamp_offset_;
223 235
224 DISALLOW_COPY_AND_ASSIGN(SourceBufferState); 236 DISALLOW_COPY_AND_ASSIGN(SourceBufferState);
225 }; 237 };
226 238
227 } // namespace media 239 } // namespace media
228 240
229 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_ 241 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STATE_H_
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/source_buffer_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698