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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // timestamps that match |start| will be removed. | 295 // timestamps that match |start| will be removed. |
296 // |*deleted_buffers| - Filled with buffers for the current playback position | 296 // |*deleted_buffers| - Filled with buffers for the current playback position |
297 // if the removal range included the current playback position. These buffers | 297 // if the removal range included the current playback position. These buffers |
298 // can be used as candidates for placing in the |track_buffer_|. | 298 // can be used as candidates for placing in the |track_buffer_|. |
299 void RemoveInternal( | 299 void RemoveInternal( |
300 base::TimeDelta start, base::TimeDelta end, bool is_exclusive, | 300 base::TimeDelta start, base::TimeDelta end, bool is_exclusive, |
301 BufferQueue* deleted_buffers); | 301 BufferQueue* deleted_buffers); |
302 | 302 |
303 Type GetType() const; | 303 Type GetType() const; |
304 | 304 |
| 305 // See GetNextBuffer() for additional details. This method handles splice |
| 306 // frame processing. |
| 307 Status HandleNextBufferWithSplice( |
| 308 scoped_refptr<StreamParserBuffer>* out_buffer); |
| 309 |
| 310 // See GetNextBuffer() for additional details. This method handles preroll |
| 311 // frame processing. |
| 312 Status HandleNextBufferWithPreroll( |
| 313 scoped_refptr<StreamParserBuffer>* out_buffer); |
| 314 |
305 // See GetNextBuffer() for additional details. The internal method hands out | 315 // See GetNextBuffer() for additional details. The internal method hands out |
306 // buffers from the |track_buffer_| and |selected_range_| without additional | 316 // single buffers from the |track_buffer_| and |selected_range_| without |
307 // processing for splice frame buffers; which is handled by GetNextBuffer(). | 317 // additional processing for splice frame or preroll buffers. |
308 Status GetNextBufferInternal(scoped_refptr<StreamParserBuffer>* out_buffer); | 318 Status GetNextBufferInternal(scoped_refptr<StreamParserBuffer>* out_buffer); |
309 | 319 |
310 // Called by PrepareRangesForNextAppend() before pruning overlapped buffers to | 320 // Called by PrepareRangesForNextAppend() before pruning overlapped buffers to |
311 // generate a splice frame with a small portion of the overlapped buffers. If | 321 // generate a splice frame with a small portion of the overlapped buffers. If |
312 // a splice frame is generated, the first buffer in |new_buffers| will have | 322 // a splice frame is generated, the first buffer in |new_buffers| will have |
313 // its timestamps, duration, and fade out preroll updated. | 323 // its timestamps, duration, and fade out preroll updated. |
314 void GenerateSpliceFrame(const BufferQueue& new_buffers); | 324 void GenerateSpliceFrame(const BufferQueue& new_buffers); |
315 | 325 |
| 326 // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_| |
| 327 // appropriately and returns true. Otherwise returns false. |
| 328 bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); |
| 329 |
316 // Callback used to report error strings that can help the web developer | 330 // Callback used to report error strings that can help the web developer |
317 // figure out what is wrong with the content. | 331 // figure out what is wrong with the content. |
318 LogCB log_cb_; | 332 LogCB log_cb_; |
319 | 333 |
320 // List of disjoint buffered ranges, ordered by start time. | 334 // List of disjoint buffered ranges, ordered by start time. |
321 RangeList ranges_; | 335 RangeList ranges_; |
322 | 336 |
323 // Indicates which decoder config is being used by the decoder. | 337 // Indicates which decoder config is being used by the decoder. |
324 // GetNextBuffer() is only allows to return buffers that have a | 338 // GetNextBuffer() is only allows to return buffers that have a |
325 // config ID that matches this index. If there is a mismatch then | 339 // config ID that matches this index. If there is a mismatch then |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 396 |
383 // The maximum amount of data in bytes the stream will keep in memory. | 397 // The maximum amount of data in bytes the stream will keep in memory. |
384 int memory_limit_; | 398 int memory_limit_; |
385 | 399 |
386 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() | 400 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() |
387 // and GetCurrentXXXDecoderConfig() must be called to update the current | 401 // and GetCurrentXXXDecoderConfig() must be called to update the current |
388 // config. GetNextBuffer() must not be called again until | 402 // config. GetNextBuffer() must not be called again until |
389 // GetCurrentXXXDecoderConfig() has been called. | 403 // GetCurrentXXXDecoderConfig() has been called. |
390 bool config_change_pending_; | 404 bool config_change_pending_; |
391 | 405 |
392 // Used by GetNextBuffer() when a buffer with fade out is returned from | 406 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when |
393 // GetNextBufferInternal(). Will be set to the returned buffer and will be | 407 // a splice frame buffer or buffer with preroll is returned from |
394 // destroyed after the splice_buffers() section has been exhausted. | 408 // GetNextBufferInternal(). |
395 scoped_refptr<StreamParserBuffer> splice_buffer_; | 409 scoped_refptr<StreamParserBuffer> pending_buffer_; |
396 | 410 |
397 // Indicates which of the splice buffers in |splice_buffer_| should be | 411 // Indicates which of the splice buffers in |splice_buffer_| should be |
398 // handled out next. | 412 // handled out next. |
399 size_t splice_buffers_index_; | 413 size_t splice_buffers_index_; |
400 | 414 |
401 // Indicates that all pre splice buffers have been handed out. | 415 // Indicates that all buffers before |pending_buffer_| have been handed out. |
402 bool pre_splice_complete_; | 416 bool pending_buffers_complete_; |
403 | 417 |
404 // Indicates that splice frame generation is enabled. | 418 // Indicates that splice frame generation is enabled. |
405 const bool splice_frames_enabled_; | 419 const bool splice_frames_enabled_; |
406 | 420 |
407 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 421 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
408 }; | 422 }; |
409 | 423 |
410 } // namespace media | 424 } // namespace media |
411 | 425 |
412 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 426 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
OLD | NEW |