| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Notifies this object that the video config has changed and buffers in | 136 // Notifies this object that the video config has changed and buffers in |
| 137 // future Append() calls should be associated with this new config. | 137 // future Append() calls should be associated with this new config. |
| 138 bool UpdateVideoConfig(const VideoDecoderConfig& config); | 138 bool UpdateVideoConfig(const VideoDecoderConfig& config); |
| 139 | 139 |
| 140 // Returns the largest distance between two adjacent buffers in this stream, | 140 // Returns the largest distance between two adjacent buffers in this stream, |
| 141 // or an estimate if no two adjacent buffers have been appended to the stream | 141 // or an estimate if no two adjacent buffers have been appended to the stream |
| 142 // yet. | 142 // yet. |
| 143 base::TimeDelta GetMaxInterbufferDistance() const; | 143 base::TimeDelta GetMaxInterbufferDistance() const; |
| 144 | 144 |
| 145 void set_memory_limit(int memory_limit) { | 145 size_t GetMemoryLimit() const { |
| 146 return memory_limit_; |
| 147 } |
| 148 |
| 149 void SetMemoryLimit(size_t memory_limit) { |
| 146 memory_limit_ = memory_limit; | 150 memory_limit_ = memory_limit; |
| 147 } | 151 } |
| 148 | 152 |
| 149 private: | 153 private: |
| 150 friend class SourceBufferStreamTest; | 154 friend class SourceBufferStreamTest; |
| 151 | 155 |
| 152 // Frees up space if the SourceBufferStream is taking up too much memory. | 156 // Frees up space if the SourceBufferStream is taking up too much memory. |
| 153 void GarbageCollectIfNeeded(); | 157 void GarbageCollectIfNeeded(); |
| 154 | 158 |
| 155 // Attempts to delete approximately |total_bytes_to_free| amount of data | 159 // Attempts to delete approximately |total_bytes_to_free| amount of data |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 393 |
| 390 // The decode timestamp on the last buffer returned by the most recent | 394 // The decode timestamp on the last buffer returned by the most recent |
| 391 // GetNextBuffer() call. Set to kNoTimestamp() if GetNextBuffer() hasn't been | 395 // GetNextBuffer() call. Set to kNoTimestamp() if GetNextBuffer() hasn't been |
| 392 // called yet or a seek has happened since the last GetNextBuffer() call. | 396 // called yet or a seek has happened since the last GetNextBuffer() call. |
| 393 DecodeTimestamp last_output_buffer_timestamp_; | 397 DecodeTimestamp last_output_buffer_timestamp_; |
| 394 | 398 |
| 395 // Stores the largest distance between two adjacent buffers in this stream. | 399 // Stores the largest distance between two adjacent buffers in this stream. |
| 396 base::TimeDelta max_interbuffer_distance_; | 400 base::TimeDelta max_interbuffer_distance_; |
| 397 | 401 |
| 398 // The maximum amount of data in bytes the stream will keep in memory. | 402 // The maximum amount of data in bytes the stream will keep in memory. |
| 399 int memory_limit_; | 403 size_t memory_limit_; |
| 400 | 404 |
| 401 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() | 405 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() |
| 402 // and GetCurrentXXXDecoderConfig() must be called to update the current | 406 // and GetCurrentXXXDecoderConfig() must be called to update the current |
| 403 // config. GetNextBuffer() must not be called again until | 407 // config. GetNextBuffer() must not be called again until |
| 404 // GetCurrentXXXDecoderConfig() has been called. | 408 // GetCurrentXXXDecoderConfig() has been called. |
| 405 bool config_change_pending_; | 409 bool config_change_pending_; |
| 406 | 410 |
| 407 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when | 411 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when |
| 408 // a splice frame buffer or buffer with preroll is returned from | 412 // a splice frame buffer or buffer with preroll is returned from |
| 409 // GetNextBufferInternal(). | 413 // GetNextBufferInternal(). |
| 410 scoped_refptr<StreamParserBuffer> pending_buffer_; | 414 scoped_refptr<StreamParserBuffer> pending_buffer_; |
| 411 | 415 |
| 412 // Indicates which of the splice buffers in |splice_buffer_| should be | 416 // Indicates which of the splice buffers in |splice_buffer_| should be |
| 413 // handled out next. | 417 // handled out next. |
| 414 size_t splice_buffers_index_; | 418 size_t splice_buffers_index_; |
| 415 | 419 |
| 416 // Indicates that all buffers before |pending_buffer_| have been handed out. | 420 // Indicates that all buffers before |pending_buffer_| have been handed out. |
| 417 bool pending_buffers_complete_; | 421 bool pending_buffers_complete_; |
| 418 | 422 |
| 419 // Indicates that splice frame generation is enabled. | 423 // Indicates that splice frame generation is enabled. |
| 420 const bool splice_frames_enabled_; | 424 const bool splice_frames_enabled_; |
| 421 | 425 |
| 422 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 426 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 423 }; | 427 }; |
| 424 | 428 |
| 425 } // namespace media | 429 } // namespace media |
| 426 | 430 |
| 427 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 431 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |