| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Attempts to delete approximately |total_bytes_to_free| amount of data | 118 // Attempts to delete approximately |total_bytes_to_free| amount of data |
| 119 // |ranges_|, starting at the front of |ranges_| and moving linearly forward | 119 // |ranges_|, starting at the front of |ranges_| and moving linearly forward |
| 120 // through the buffers. Deletes starting from the back if |reverse_direction| | 120 // through the buffers. Deletes starting from the back if |reverse_direction| |
| 121 // is true. Returns the number of bytes freed. | 121 // is true. Returns the number of bytes freed. |
| 122 int FreeBuffers(int total_bytes_to_free, bool reverse_direction); | 122 int FreeBuffers(int total_bytes_to_free, bool reverse_direction); |
| 123 | 123 |
| 124 // Appends |new_buffers| into |range_for_new_buffers_itr|, handling start and | 124 // Appends |new_buffers| into |range_for_new_buffers_itr|, handling start and |
| 125 // end overlaps if necessary. | 125 // end overlaps if necessary. |
| 126 // |deleted_buffers| is an output parameter containing candidates for | 126 // |deleted_buffers| is an output parameter containing candidates for |
| 127 // |track_buffer_|. | 127 // |track_buffer_|. |
| 128 void InsertIntoExistingRange( | 128 // Returns true if the buffers were successfully inserted into the existing |
| 129 // range. |
| 130 // Returns false if the buffers being inserted triggered an error. |
| 131 bool InsertIntoExistingRange( |
| 129 const RangeList::iterator& range_for_new_buffers_itr, | 132 const RangeList::iterator& range_for_new_buffers_itr, |
| 130 const BufferQueue& new_buffers, | 133 const BufferQueue& new_buffers, |
| 131 BufferQueue* deleted_buffers); | 134 BufferQueue* deleted_buffers); |
| 132 | 135 |
| 133 // Resolve overlapping ranges such that no ranges overlap anymore. | 136 // Resolve overlapping ranges such that no ranges overlap anymore. |
| 134 // |range_with_new_buffers_itr| points to the range that has newly appended | 137 // |range_with_new_buffers_itr| points to the range that has newly appended |
| 135 // buffers. | 138 // buffers. |
| 136 // |deleted_buffers| is an output parameter containing candidates for | 139 // |deleted_buffers| is an output parameter containing candidates for |
| 137 // |track_buffer_|. | 140 // |track_buffer_|. |
| 138 void ResolveCompleteOverlaps( | 141 void ResolveCompleteOverlaps( |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 293 |
| 291 // Points to the range containing the current media segment being appended. | 294 // Points to the range containing the current media segment being appended. |
| 292 RangeList::iterator range_for_next_append_; | 295 RangeList::iterator range_for_next_append_; |
| 293 | 296 |
| 294 // True when the next call to Append() begins a new media segment. | 297 // True when the next call to Append() begins a new media segment. |
| 295 bool new_media_segment_; | 298 bool new_media_segment_; |
| 296 | 299 |
| 297 // The timestamp of the last buffer appended to the media segment, set to | 300 // The timestamp of the last buffer appended to the media segment, set to |
| 298 // kNoTimestamp() if the beginning of the segment. | 301 // kNoTimestamp() if the beginning of the segment. |
| 299 base::TimeDelta last_appended_buffer_timestamp_; | 302 base::TimeDelta last_appended_buffer_timestamp_; |
| 303 bool last_appended_buffer_is_keyframe_; |
| 300 | 304 |
| 301 // The decode timestamp on the last buffer returned by the most recent | 305 // The decode timestamp on the last buffer returned by the most recent |
| 302 // GetNextBuffer() call. Set to kNoTimestamp() if GetNextBuffer() hasn't been | 306 // GetNextBuffer() call. Set to kNoTimestamp() if GetNextBuffer() hasn't been |
| 303 // called yet or a seek has happened since the last GetNextBuffer() call. | 307 // called yet or a seek has happened since the last GetNextBuffer() call. |
| 304 base::TimeDelta last_output_buffer_timestamp_; | 308 base::TimeDelta last_output_buffer_timestamp_; |
| 305 | 309 |
| 306 // Stores the largest distance between two adjacent buffers in this stream. | 310 // Stores the largest distance between two adjacent buffers in this stream. |
| 307 base::TimeDelta max_interbuffer_distance_; | 311 base::TimeDelta max_interbuffer_distance_; |
| 308 | 312 |
| 309 // The maximum amount of data in bytes the stream will keep in memory. | 313 // The maximum amount of data in bytes the stream will keep in memory. |
| 310 int memory_limit_; | 314 int memory_limit_; |
| 311 | 315 |
| 312 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() | 316 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() |
| 313 // and GetCurrentXXXDecoderConfig() must be called to update the current | 317 // and GetCurrentXXXDecoderConfig() must be called to update the current |
| 314 // config. GetNextBuffer() must not be called again until | 318 // config. GetNextBuffer() must not be called again until |
| 315 // GetCurrentXXXDecoderConfig() has been called. | 319 // GetCurrentXXXDecoderConfig() has been called. |
| 316 bool config_change_pending_; | 320 bool config_change_pending_; |
| 317 | 321 |
| 318 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 322 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 319 }; | 323 }; |
| 320 | 324 |
| 321 } // namespace media | 325 } // namespace media |
| 322 | 326 |
| 323 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 327 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |