| OLD | NEW |
| 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 <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Removes buffers between |start| and |end| according to the steps | 50 // Removes buffers between |start| and |end| according to the steps |
| 51 // in the "Coded Frame Removal Algorithm" in the Media Source | 51 // in the "Coded Frame Removal Algorithm" in the Media Source |
| 52 // Extensions Spec. | 52 // Extensions Spec. |
| 53 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal | 53 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal |
| 54 // | 54 // |
| 55 // |duration| is the current duration of the presentation. It is | 55 // |duration| is the current duration of the presentation. It is |
| 56 // required by the computation outlined in the spec. | 56 // required by the computation outlined in the spec. |
| 57 void Remove(base::TimeDelta start, base::TimeDelta end, | 57 void Remove(base::TimeDelta start, base::TimeDelta end, |
| 58 base::TimeDelta duration); | 58 base::TimeDelta duration); |
| 59 | 59 |
| 60 // If the buffer is full, attempts to try to free up space, as specified in |
| 61 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. |
| 62 // Returns false iff buffer is still full after running eviction. |
| 63 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction |
| 64 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize); |
| 65 |
| 60 // Signal to the stream that duration has changed to |duration|. | 66 // Signal to the stream that duration has changed to |duration|. |
| 61 void OnSetDuration(base::TimeDelta duration); | 67 void OnSetDuration(base::TimeDelta duration); |
| 62 | 68 |
| 63 // Returns the range of buffered data in this stream, capped at |duration|. | 69 // Returns the range of buffered data in this stream, capped at |duration|. |
| 64 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const; | 70 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const; |
| 65 | 71 |
| 66 // Returns the duration of the buffered data. | 72 // Returns the duration of the buffered data. |
| 67 // Returns base::TimeDelta() if the stream has no buffered data. | 73 // Returns base::TimeDelta() if the stream has no buffered data. |
| 68 base::TimeDelta GetBufferedDuration() const; | 74 base::TimeDelta GetBufferedDuration() const; |
| 69 | 75 |
| 76 // Returns the size of the buffered data in bytes. |
| 77 size_t GetBufferedSize() const; |
| 78 |
| 70 // Signal to the stream that buffers handed in through subsequent calls to | 79 // Signal to the stream that buffers handed in through subsequent calls to |
| 71 // Append() belong to a media segment that starts at |start_timestamp|. | 80 // Append() belong to a media segment that starts at |start_timestamp|. |
| 72 void OnNewMediaSegment(DecodeTimestamp start_timestamp); | 81 void OnNewMediaSegment(DecodeTimestamp start_timestamp); |
| 73 | 82 |
| 74 // Called when midstream config updates occur. | 83 // Called when midstream config updates occur. |
| 75 // Returns true if the new config is accepted. | 84 // Returns true if the new config is accepted. |
| 76 // Returns false if the new config should trigger an error. | 85 // Returns false if the new config should trigger an error. |
| 77 bool UpdateAudioConfig(const AudioDecoderConfig& config, | 86 bool UpdateAudioConfig(const AudioDecoderConfig& config, |
| 78 const scoped_refptr<MediaLog>& media_log); | 87 const scoped_refptr<MediaLog>& media_log); |
| 79 bool UpdateVideoConfig(const VideoDecoderConfig& config, | 88 bool UpdateVideoConfig(const VideoDecoderConfig& config, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void Abort(const std::string& id, | 246 void Abort(const std::string& id, |
| 238 base::TimeDelta append_window_start, | 247 base::TimeDelta append_window_start, |
| 239 base::TimeDelta append_window_end, | 248 base::TimeDelta append_window_end, |
| 240 base::TimeDelta* timestamp_offset); | 249 base::TimeDelta* timestamp_offset); |
| 241 | 250 |
| 242 // Remove buffers between |start| and |end| for the source buffer | 251 // Remove buffers between |start| and |end| for the source buffer |
| 243 // associated with |id|. | 252 // associated with |id|. |
| 244 void Remove(const std::string& id, base::TimeDelta start, | 253 void Remove(const std::string& id, base::TimeDelta start, |
| 245 base::TimeDelta end); | 254 base::TimeDelta end); |
| 246 | 255 |
| 256 // If the buffer is full, attempts to try to free up space, as specified in |
| 257 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. |
| 258 // Returns false iff buffer is still full after running eviction. |
| 259 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction |
| 260 bool EvictCodedFrames(const std::string& id, |
| 261 base::TimeDelta currentMediaTime, |
| 262 size_t newDataSize); |
| 263 |
| 247 // Returns the current presentation duration. | 264 // Returns the current presentation duration. |
| 248 double GetDuration(); | 265 double GetDuration(); |
| 249 double GetDuration_Locked(); | 266 double GetDuration_Locked(); |
| 250 | 267 |
| 251 // Notifies the demuxer that the duration of the media has changed to | 268 // Notifies the demuxer that the duration of the media has changed to |
| 252 // |duration|. | 269 // |duration|. |
| 253 void SetDuration(double duration); | 270 void SetDuration(double duration); |
| 254 | 271 |
| 255 // Returns true if the source buffer associated with |id| is currently parsing | 272 // Returns true if the source buffer associated with |id| is currently parsing |
| 256 // a media segment, or false otherwise. | 273 // a media segment, or false otherwise. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 416 |
| 400 // Indicates that splice frame generation is enabled. | 417 // Indicates that splice frame generation is enabled. |
| 401 const bool splice_frames_enabled_; | 418 const bool splice_frames_enabled_; |
| 402 | 419 |
| 403 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 420 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 404 }; | 421 }; |
| 405 | 422 |
| 406 } // namespace media | 423 } // namespace media |
| 407 | 424 |
| 408 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 425 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |