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

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

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: CR feedback 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CHUNK_DEMUXER_H_ 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_
6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <utility> 15 #include <utility>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/memory_pressure_listener.h"
19 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
20 #include "media/base/byte_queue.h" 21 #include "media/base/byte_queue.h"
21 #include "media/base/demuxer.h" 22 #include "media/base/demuxer.h"
22 #include "media/base/demuxer_stream.h" 23 #include "media/base/demuxer_stream.h"
23 #include "media/base/media_tracks.h" 24 #include "media/base/media_tracks.h"
24 #include "media/base/ranges.h" 25 #include "media/base/ranges.h"
25 #include "media/base/stream_parser.h" 26 #include "media/base/stream_parser.h"
26 #include "media/filters/source_buffer_state.h" 27 #include "media/filters/source_buffer_state.h"
27 #include "media/filters/source_buffer_stream.h" 28 #include "media/filters/source_buffer_stream.h"
28 29
(...skipping 30 matching lines...) Expand all
59 // required by the computation outlined in the spec. 60 // required by the computation outlined in the spec.
60 void Remove(base::TimeDelta start, base::TimeDelta end, 61 void Remove(base::TimeDelta start, base::TimeDelta end,
61 base::TimeDelta duration); 62 base::TimeDelta duration);
62 63
63 // If the buffer is full, attempts to try to free up space, as specified in 64 // If the buffer is full, attempts to try to free up space, as specified in
64 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. 65 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec.
65 // Returns false iff buffer is still full after running eviction. 66 // Returns false iff buffer is still full after running eviction.
66 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction 67 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
67 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize); 68 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize);
68 69
70 void OnMemoryPressure(
71 DecodeTimestamp media_time,
72 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level,
73 bool force_gc);
DaleCurtis 2017/01/27 00:58:23 s/force_gc/force_instant_gc/ since technically the
servolk 2017/01/27 01:16:17 Done.
74
69 // Signal to the stream that duration has changed to |duration|. 75 // Signal to the stream that duration has changed to |duration|.
70 void OnSetDuration(base::TimeDelta duration); 76 void OnSetDuration(base::TimeDelta duration);
71 77
72 // Returns the range of buffered data in this stream, capped at |duration|. 78 // Returns the range of buffered data in this stream, capped at |duration|.
73 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const; 79 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const;
74 80
75 // Returns the highest PTS of the buffered data. 81 // Returns the highest PTS of the buffered data.
76 // Returns base::TimeDelta() if the stream has no buffered data. 82 // Returns base::TimeDelta() if the stream has no buffered data.
77 base::TimeDelta GetHighestPresentationTimestamp() const; 83 base::TimeDelta GetHighestPresentationTimestamp() const;
78 84
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::TimeDelta end); 269 base::TimeDelta end);
264 270
265 // If the buffer is full, attempts to try to free up space, as specified in 271 // If the buffer is full, attempts to try to free up space, as specified in
266 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. 272 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec.
267 // Returns false iff buffer is still full after running eviction. 273 // Returns false iff buffer is still full after running eviction.
268 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction 274 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
269 bool EvictCodedFrames(const std::string& id, 275 bool EvictCodedFrames(const std::string& id,
270 base::TimeDelta currentMediaTime, 276 base::TimeDelta currentMediaTime,
271 size_t newDataSize); 277 size_t newDataSize);
272 278
279 void OnMemoryPressure(
280 base::TimeDelta currentMediaTime,
281 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level,
282 bool force_gc);
283
273 // Returns the current presentation duration. 284 // Returns the current presentation duration.
274 double GetDuration(); 285 double GetDuration();
275 double GetDuration_Locked(); 286 double GetDuration_Locked();
276 287
277 // Notifies the demuxer that the duration of the media has changed to 288 // Notifies the demuxer that the duration of the media has changed to
278 // |duration|. 289 // |duration|.
279 void SetDuration(double duration); 290 void SetDuration(double duration);
280 291
281 // Returns true if the source buffer associated with |id| is currently parsing 292 // Returns true if the source buffer associated with |id| is currently parsing
282 // a media segment, or false otherwise. 293 // a media segment, or false otherwise.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 int detected_text_track_count_; 452 int detected_text_track_count_;
442 453
443 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; 454 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_;
444 455
445 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 456 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
446 }; 457 };
447 458
448 } // namespace media 459 } // namespace media
449 460
450 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 461 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698