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 // SourceBufferStream is a data structure that stores media Buffers in ranges. | 5 // SourceBufferStream is a data structure that stores media Buffers in ranges. |
6 // Buffers can be appended out of presentation order. Buffers are retrieved by | 6 // Buffers can be appended out of presentation order. Buffers are retrieved by |
7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are | 7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are |
8 // returned in sequential presentation order. | 8 // returned in sequential presentation order. |
9 | 9 |
10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Removes buffers between |start| and |end| according to the steps | 79 // Removes buffers between |start| and |end| according to the steps |
80 // in the "Coded Frame Removal Algorithm" in the Media Source | 80 // in the "Coded Frame Removal Algorithm" in the Media Source |
81 // Extensions Spec. | 81 // Extensions Spec. |
82 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal | 82 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal |
83 // | 83 // |
84 // |duration| is the current duration of the presentation. It is | 84 // |duration| is the current duration of the presentation. It is |
85 // required by the computation outlined in the spec. | 85 // required by the computation outlined in the spec. |
86 void Remove(base::TimeDelta start, base::TimeDelta end, | 86 void Remove(base::TimeDelta start, base::TimeDelta end, |
87 base::TimeDelta duration); | 87 base::TimeDelta duration); |
88 | 88 |
| 89 // Update the playback time. |
| 90 // This playback time is used to avoid garbage collecting buffers |
| 91 // corresponding to the playback time: |
| 92 // MSE spec - 2.4.4 SourceBuffer Monitoring. |
| 93 void NotifyMediaTimeUpdate(base::TimeDelta media_time); |
| 94 |
89 // Changes the SourceBufferStream's state so that it will start returning | 95 // Changes the SourceBufferStream's state so that it will start returning |
90 // buffers starting from the closest keyframe before |timestamp|. | 96 // buffers starting from the closest keyframe before |timestamp|. |
91 void Seek(base::TimeDelta timestamp); | 97 void Seek(base::TimeDelta timestamp); |
92 | 98 |
93 // Returns true if the SourceBufferStream has seeked to a time without | 99 // Returns true if the SourceBufferStream has seeked to a time without |
94 // buffered data and is waiting for more data to be appended. | 100 // buffered data and is waiting for more data to be appended. |
95 bool IsSeekPending() const; | 101 bool IsSeekPending() const; |
96 | 102 |
97 // Notifies the SourceBufferStream that the media duration has been changed to | 103 // Notifies the SourceBufferStream that the media duration has been changed to |
98 // |duration| so it should drop any data past that point. | 104 // |duration| so it should drop any data past that point. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 bool end_of_stream_; | 367 bool end_of_stream_; |
362 | 368 |
363 // Timestamp of the last request to Seek(). | 369 // Timestamp of the last request to Seek(). |
364 base::TimeDelta seek_buffer_timestamp_; | 370 base::TimeDelta seek_buffer_timestamp_; |
365 | 371 |
366 // Pointer to the seeked-to Range. This is the range from which | 372 // Pointer to the seeked-to Range. This is the range from which |
367 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been | 373 // GetNextBuffer() calls are fulfilled after the |track_buffer_| has been |
368 // emptied. | 374 // emptied. |
369 SourceBufferRange* selected_range_; | 375 SourceBufferRange* selected_range_; |
370 | 376 |
| 377 // Current media time. |
| 378 // This does not need to be very accurate as long as it represents a lower |
| 379 // bound of the media time. |
| 380 base::TimeDelta current_media_time_; |
| 381 |
371 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If | 382 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If |
372 // |track_buffer_| is empty, return buffers from |selected_range_|. | 383 // |track_buffer_| is empty, return buffers from |selected_range_|. |
373 BufferQueue track_buffer_; | 384 BufferQueue track_buffer_; |
374 | 385 |
375 // The start time of the current media segment being appended. | 386 // The start time of the current media segment being appended. |
376 base::TimeDelta media_segment_start_time_; | 387 base::TimeDelta media_segment_start_time_; |
377 | 388 |
378 // Points to the range containing the current media segment being appended. | 389 // Points to the range containing the current media segment being appended. |
379 RangeList::iterator range_for_next_append_; | 390 RangeList::iterator range_for_next_append_; |
380 | 391 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 428 |
418 // Indicates that splice frame generation is enabled. | 429 // Indicates that splice frame generation is enabled. |
419 const bool splice_frames_enabled_; | 430 const bool splice_frames_enabled_; |
420 | 431 |
421 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 432 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
422 }; | 433 }; |
423 | 434 |
424 } // namespace media | 435 } // namespace media |
425 | 436 |
426 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 437 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
OLD | NEW |