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