| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // UpdateTrackBuffer() takes these |deleted_buffers| and decides whether it | 148 // UpdateTrackBuffer() takes these |deleted_buffers| and decides whether it |
| 149 // wants to save any buffers into |track_buffer_|. | 149 // wants to save any buffers into |track_buffer_|. |
| 150 // TODO(vrk): This is a little crazy! Ideas for cleanup in crbug.com/129623. | 150 // TODO(vrk): This is a little crazy! Ideas for cleanup in crbug.com/129623. |
| 151 void UpdateTrackBuffer(const BufferQueue& deleted_buffers); | 151 void UpdateTrackBuffer(const BufferQueue& deleted_buffers); |
| 152 | 152 |
| 153 // Checks to see if |range_with_new_buffers_itr| can be merged with the range | 153 // Checks to see if |range_with_new_buffers_itr| can be merged with the range |
| 154 // next to it, and merges them if so. | 154 // next to it, and merges them if so. |
| 155 void MergeWithAdjacentRangeIfNecessary( | 155 void MergeWithAdjacentRangeIfNecessary( |
| 156 const RangeList::iterator& range_with_new_buffers_itr); | 156 const RangeList::iterator& range_with_new_buffers_itr); |
| 157 | 157 |
| 158 // Deletes the buffers between |start_timestamp|, |end_timestamp| from |
| 159 // |range|. Deletes between [start,end] if |is_range_exclusive| is true, or |
| 160 // (start,end) if |is_range_exclusive| is false. |
| 161 // Buffers are deleted in GOPs, so this method may delete buffers past |
| 162 // |end_timestamp| if the keyframe a buffer depends on was deleted. |
| 163 // Returns true if the |next_buffer_index_| is reset, and places the buffers |
| 164 // removed from the range starting at |next_buffer_index_| in |
| 165 // |deleted_buffers|. |
| 166 bool DeleteBetween(SourceBufferRange* range, |
| 167 base::TimeDelta start_timestamp, |
| 168 base::TimeDelta end_timestamp, |
| 169 bool is_range_exclusive, |
| 170 BufferQueue* deleted_buffers); |
| 171 |
| 172 // Returns true if |second_timestamp| is the timestamp of the next buffer in |
| 173 // sequence after |first_timestamp|, false otherwise. |
| 174 bool AreAdjacentInSequence( |
| 175 base::TimeDelta first_timestamp, base::TimeDelta second_timestamp) const; |
| 176 |
| 158 // Helper method that returns the timestamp for the next buffer that | 177 // Helper method that returns the timestamp for the next buffer that |
| 159 // |selected_range_| will return from GetNextBuffer() call, or kNoTimestamp() | 178 // |selected_range_| will return from GetNextBuffer() call, or kNoTimestamp() |
| 160 // if in between seeking (i.e. |selected_range_| is null). | 179 // if in between seeking (i.e. |selected_range_| is null). |
| 161 base::TimeDelta GetNextBufferTimestamp(); | 180 base::TimeDelta GetNextBufferTimestamp(); |
| 162 | 181 |
| 163 // Returns the timestamp of the last buffer in the |selected_range_| or | 182 // Returns the timestamp of the last buffer in the |selected_range_| or |
| 164 // kNoTimestamp() if |selected_range_| is null. | 183 // kNoTimestamp() if |selected_range_| is null. |
| 165 base::TimeDelta GetEndBufferTimestamp(); | 184 base::TimeDelta GetEndBufferTimestamp(); |
| 166 | 185 |
| 167 // Finds the range that should contain a media segment that begins with | 186 // Finds the range that should contain a media segment that begins with |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // config. GetNextBuffer() must not be called again until | 286 // config. GetNextBuffer() must not be called again until |
| 268 // GetCurrentXXXDecoderConfig() has been called. | 287 // GetCurrentXXXDecoderConfig() has been called. |
| 269 bool config_change_pending_; | 288 bool config_change_pending_; |
| 270 | 289 |
| 271 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 290 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 272 }; | 291 }; |
| 273 | 292 |
| 274 } // namespace media | 293 } // namespace media |
| 275 | 294 |
| 276 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 295 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |