| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool Append(const BufferQueue& buffers); | 60 bool Append(const BufferQueue& buffers); |
| 61 | 61 |
| 62 // Changes the SourceBufferStream's state so that it will start returning | 62 // Changes the SourceBufferStream's state so that it will start returning |
| 63 // buffers starting from the closest keyframe before |timestamp|. | 63 // buffers starting from the closest keyframe before |timestamp|. |
| 64 void Seek(base::TimeDelta timestamp); | 64 void Seek(base::TimeDelta timestamp); |
| 65 | 65 |
| 66 // Returns true if the SourceBufferStream has seeked to a time without | 66 // Returns true if the SourceBufferStream has seeked to a time without |
| 67 // buffered data and is waiting for more data to be appended. | 67 // buffered data and is waiting for more data to be appended. |
| 68 bool IsSeekPending() const; | 68 bool IsSeekPending() const; |
| 69 | 69 |
| 70 // Notifies the SourceBufferStream that the media duration has been changed to |
| 71 // |duration| so it should drop any data past that point. |
| 72 void OnSetDuration(base::TimeDelta duration); |
| 73 |
| 70 // Fills |out_buffer| with a new buffer. Buffers are presented in order from | 74 // Fills |out_buffer| with a new buffer. Buffers are presented in order from |
| 71 // the last call to Seek(), or starting with the first buffer appended if | 75 // the last call to Seek(), or starting with the first buffer appended if |
| 72 // Seek() has not been called yet. | 76 // Seek() has not been called yet. |
| 73 // |out_buffer|'s timestamp may be earlier than the |timestamp| passed to | 77 // |out_buffer|'s timestamp may be earlier than the |timestamp| passed to |
| 74 // the last Seek() call. | 78 // the last Seek() call. |
| 75 // Returns kSuccess if |out_buffer| is filled with a valid buffer, kNeedBuffer | 79 // Returns kSuccess if |out_buffer| is filled with a valid buffer, kNeedBuffer |
| 76 // if there is not enough data buffered to fulfill the request, and | 80 // if there is not enough data buffered to fulfill the request, and |
| 77 // kConfigChange if the next buffer requires a config change. | 81 // kConfigChange if the next buffer requires a config change. |
| 78 Status GetNextBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); | 82 Status GetNextBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); |
| 79 | 83 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 RangeList::iterator AddToRanges(SourceBufferRange* new_range); | 174 RangeList::iterator AddToRanges(SourceBufferRange* new_range); |
| 171 | 175 |
| 172 // Returns an iterator that points to the place in |ranges_| where | 176 // Returns an iterator that points to the place in |ranges_| where |
| 173 // |selected_range_| lives. | 177 // |selected_range_| lives. |
| 174 RangeList::iterator GetSelectedRangeItr(); | 178 RangeList::iterator GetSelectedRangeItr(); |
| 175 | 179 |
| 176 // Sets the |selected_range_| to |range| and resets the next buffer position | 180 // Sets the |selected_range_| to |range| and resets the next buffer position |
| 177 // for the previous |selected_range_|. | 181 // for the previous |selected_range_|. |
| 178 void SetSelectedRange(SourceBufferRange* range); | 182 void SetSelectedRange(SourceBufferRange* range); |
| 179 | 183 |
| 184 // Resets this stream back to an unseeked state. |
| 185 void ResetSeekState(); |
| 186 |
| 180 // Returns true if |seek_timestamp| refers to the beginning of the first range | 187 // Returns true if |seek_timestamp| refers to the beginning of the first range |
| 181 // in |ranges_|, false otherwise or if |ranges_| is empty. | 188 // in |ranges_|, false otherwise or if |ranges_| is empty. |
| 182 bool ShouldSeekToStartOfBuffered(base::TimeDelta seek_timestamp) const; | 189 bool ShouldSeekToStartOfBuffered(base::TimeDelta seek_timestamp) const; |
| 183 | 190 |
| 184 // Returns true if the timestamps of |buffers| are monotonically increasing | 191 // Returns true if the timestamps of |buffers| are monotonically increasing |
| 185 // since the previous append to the media segment, false otherwise. | 192 // since the previous append to the media segment, false otherwise. |
| 186 bool IsMonotonicallyIncreasing(const BufferQueue& buffers) const; | 193 bool IsMonotonicallyIncreasing(const BufferQueue& buffers) const; |
| 187 | 194 |
| 188 // Returns true if |selected_range_| is the only range in |ranges_| that | 195 // Returns true if |selected_range_| is the only range in |ranges_| that |
| 189 // HasNextBufferPosition(). | 196 // HasNextBufferPosition(). |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // config. GetNextBuffer() must not be called again until | 267 // config. GetNextBuffer() must not be called again until |
| 261 // GetCurrentXXXDecoderConfig() has been called. | 268 // GetCurrentXXXDecoderConfig() has been called. |
| 262 bool config_change_pending_; | 269 bool config_change_pending_; |
| 263 | 270 |
| 264 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 271 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 265 }; | 272 }; |
| 266 | 273 |
| 267 } // namespace media | 274 } // namespace media |
| 268 | 275 |
| 269 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 276 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |