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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 bool splice_frames_enabled); | 59 bool splice_frames_enabled); |
60 SourceBufferStream(const VideoDecoderConfig& video_config, | 60 SourceBufferStream(const VideoDecoderConfig& video_config, |
61 const scoped_refptr<MediaLog>& media_log, | 61 const scoped_refptr<MediaLog>& media_log, |
62 bool splice_frames_enabled); | 62 bool splice_frames_enabled); |
63 SourceBufferStream(const TextTrackConfig& text_config, | 63 SourceBufferStream(const TextTrackConfig& text_config, |
64 const scoped_refptr<MediaLog>& media_log, | 64 const scoped_refptr<MediaLog>& media_log, |
65 bool splice_frames_enabled); | 65 bool splice_frames_enabled); |
66 | 66 |
67 ~SourceBufferStream(); | 67 ~SourceBufferStream(); |
68 | 68 |
69 // Signals that the next buffers appended are part of a new media segment | 69 // Signals that the next buffers appended are part of a new coded frame group |
70 // starting at |media_segment_start_time|. | 70 // starting at |coded_frame_group_start_time|. |
71 // TODO(acolwell/wolenetz): This should be changed to a presentation | 71 // TODO(acolwell/wolenetz): This should be changed to a presentation |
72 // timestamp. See http://crbug.com/402502 | 72 // timestamp. See http://crbug.com/402502 |
73 void OnNewMediaSegment(DecodeTimestamp media_segment_start_time); | 73 void OnStartOfCodedFrameGroup(DecodeTimestamp coded_frame_group_start_time); |
74 | 74 |
75 // Add the |buffers| to the SourceBufferStream. Buffers within the queue are | 75 // Add the |buffers| to the SourceBufferStream. Buffers within the queue are |
76 // expected to be in order, but multiple calls to Append() may add buffers out | 76 // expected to be in order, but multiple calls to Append() may add buffers out |
77 // of order or overlapping. Assumes all buffers within |buffers| are in | 77 // of order or overlapping. Assumes all buffers within |buffers| are in |
78 // presentation order and are non-overlapping. | 78 // presentation order and are non-overlapping. |
79 // Returns true if Append() was successful, false if |buffers| are not added. | 79 // Returns true if Append() was successful, false if |buffers| are not added. |
80 // TODO(vrk): Implement garbage collection. (crbug.com/125070) | 80 // TODO(vrk): Implement garbage collection. (crbug.com/125070) |
81 bool Append(const BufferQueue& buffers); | 81 bool Append(const BufferQueue& buffers); |
82 | 82 |
83 // Removes buffers between |start| and |end| according to the steps | 83 // Removes buffers between |start| and |end| according to the steps |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 SourceBufferRange* selected_range_ = nullptr; | 388 SourceBufferRange* selected_range_ = nullptr; |
389 | 389 |
390 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If | 390 // Queue of the next buffers to be returned from calls to GetNextBuffer(). If |
391 // |track_buffer_| is empty, return buffers from |selected_range_|. | 391 // |track_buffer_| is empty, return buffers from |selected_range_|. |
392 BufferQueue track_buffer_; | 392 BufferQueue track_buffer_; |
393 | 393 |
394 // If there has been no intervening Seek, this will be true if the last | 394 // If there has been no intervening Seek, this will be true if the last |
395 // emitted buffer emptied |track_buffer_|. | 395 // emitted buffer emptied |track_buffer_|. |
396 bool just_exhausted_track_buffer_ = false; | 396 bool just_exhausted_track_buffer_ = false; |
397 | 397 |
398 // The start time of the current media segment being appended. | 398 // The start time of the current coded frame group being appended. |
399 DecodeTimestamp media_segment_start_time_; | 399 DecodeTimestamp coded_frame_group_start_time_; |
400 | 400 |
401 // Points to the range containing the current media segment being appended. | 401 // Points to the range containing the current media segment being appended. |
402 RangeList::iterator range_for_next_append_; | 402 RangeList::iterator range_for_next_append_; |
403 | 403 |
404 // True when the next call to Append() begins a new media segment. | 404 // True when the next call to Append() begins a new coded frame group. |
405 bool new_media_segment_ = false; | 405 // TODO(wolenetz): Simplify by passing this flag into Append(). |
| 406 bool new_coded_frame_group_ = false; |
406 | 407 |
407 // The timestamp of the last buffer appended to the media segment, set to | 408 // The timestamp of the last buffer appended to the media segment, set to |
408 // kNoDecodeTimestamp() if the beginning of the segment. | 409 // kNoDecodeTimestamp() if the beginning of the segment. |
409 DecodeTimestamp last_appended_buffer_timestamp_; | 410 DecodeTimestamp last_appended_buffer_timestamp_; |
410 bool last_appended_buffer_is_keyframe_ = false; | 411 bool last_appended_buffer_is_keyframe_ = false; |
411 | 412 |
412 // The decode timestamp on the last buffer returned by the most recent | 413 // The decode timestamp on the last buffer returned by the most recent |
413 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't | 414 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't |
414 // been called yet or a seek has happened since the last GetNextBuffer() call. | 415 // been called yet or a seek has happened since the last GetNextBuffer() call. |
415 DecodeTimestamp last_output_buffer_timestamp_; | 416 DecodeTimestamp last_output_buffer_timestamp_; |
(...skipping 29 matching lines...) Expand all Loading... |
445 int num_splice_generation_warning_logs_ = 0; | 446 int num_splice_generation_warning_logs_ = 0; |
446 int num_splice_generation_success_logs_ = 0; | 447 int num_splice_generation_success_logs_ = 0; |
447 int num_track_buffer_gap_warning_logs_ = 0; | 448 int num_track_buffer_gap_warning_logs_ = 0; |
448 | 449 |
449 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 450 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
450 }; | 451 }; |
451 | 452 |
452 } // namespace media | 453 } // namespace media |
453 | 454 |
454 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 455 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
OLD | NEW |