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

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

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: typo 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
69 // Signal to the stream that duration has changed to |duration|. 74 // Signal to the stream that duration has changed to |duration|.
70 void OnSetDuration(base::TimeDelta duration); 75 void OnSetDuration(base::TimeDelta duration);
71 76
72 // Returns the range of buffered data in this stream, capped at |duration|. 77 // Returns the range of buffered data in this stream, capped at |duration|.
73 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const; 78 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const;
74 79
75 // Returns the highest PTS of the buffered data. 80 // Returns the highest PTS of the buffered data.
76 // Returns base::TimeDelta() if the stream has no buffered data. 81 // Returns base::TimeDelta() if the stream has no buffered data.
77 base::TimeDelta GetHighestPresentationTimestamp() const; 82 base::TimeDelta GetHighestPresentationTimestamp() const;
78 83
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::TimeDelta end); 268 base::TimeDelta end);
264 269
265 // If the buffer is full, attempts to try to free up space, as specified in 270 // 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. 271 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec.
267 // Returns false iff buffer is still full after running eviction. 272 // Returns false iff buffer is still full after running eviction.
268 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction 273 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
269 bool EvictCodedFrames(const std::string& id, 274 bool EvictCodedFrames(const std::string& id,
270 base::TimeDelta currentMediaTime, 275 base::TimeDelta currentMediaTime,
271 size_t newDataSize); 276 size_t newDataSize);
272 277
278 void OnMemoryPressure(
279 base::TimeDelta currentMediaTime,
280 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
281
273 // Returns the current presentation duration. 282 // Returns the current presentation duration.
274 double GetDuration(); 283 double GetDuration();
275 double GetDuration_Locked(); 284 double GetDuration_Locked();
276 285
277 // Notifies the demuxer that the duration of the media has changed to 286 // Notifies the demuxer that the duration of the media has changed to
278 // |duration|. 287 // |duration|.
279 void SetDuration(double duration); 288 void SetDuration(double duration);
280 289
281 // Returns true if the source buffer associated with |id| is currently parsing 290 // Returns true if the source buffer associated with |id| is currently parsing
282 // a media segment, or false otherwise. 291 // a media segment, or false otherwise.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 int detected_text_track_count_; 450 int detected_text_track_count_;
442 451
443 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; 452 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_;
444 453
445 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 454 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
446 }; 455 };
447 456
448 } // namespace media 457 } // namespace media
449 458
450 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 459 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698