| 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 void SetMemoryLimit(size_t memory_limit); |
| 146 memory_limit_ = memory_limit; | |
| 147 } | |
| 148 | 146 |
| 149 private: | 147 private: |
| 150 friend class SourceBufferStreamTest; | 148 friend class SourceBufferStreamTest; |
| 151 | 149 |
| 152 // Frees up space if the SourceBufferStream is taking up too much memory. | 150 // Frees up space if the SourceBufferStream is taking up too much memory. |
| 153 void GarbageCollectIfNeeded(); | 151 void GarbageCollectIfNeeded(); |
| 154 | 152 |
| 155 // Attempts to delete approximately |total_bytes_to_free| amount of data | 153 // Attempts to delete approximately |total_bytes_to_free| amount of data |
| 156 // |ranges_|, starting at the front of |ranges_| and moving linearly forward | 154 // |ranges_|, starting at the front of |ranges_| and moving linearly forward |
| 157 // through the buffers. Deletes starting from the back if |reverse_direction| | 155 // through the buffers. Deletes starting from the back if |reverse_direction| |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 387 |
| 390 // The decode timestamp on the last buffer returned by the most recent | 388 // The decode timestamp on the last buffer returned by the most recent |
| 391 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't | 389 // GetNextBuffer() call. Set to kNoDecodeTimestamp() if GetNextBuffer() hasn't |
| 392 // been called yet or a seek has happened since the last GetNextBuffer() call. | 390 // been called yet or a seek has happened since the last GetNextBuffer() call. |
| 393 DecodeTimestamp last_output_buffer_timestamp_; | 391 DecodeTimestamp last_output_buffer_timestamp_; |
| 394 | 392 |
| 395 // Stores the largest distance between two adjacent buffers in this stream. | 393 // Stores the largest distance between two adjacent buffers in this stream. |
| 396 base::TimeDelta max_interbuffer_distance_; | 394 base::TimeDelta max_interbuffer_distance_; |
| 397 | 395 |
| 398 // The maximum amount of data in bytes the stream will keep in memory. | 396 // The maximum amount of data in bytes the stream will keep in memory. |
| 399 int memory_limit_; | 397 size_t memory_limit_; |
| 400 | 398 |
| 401 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() | 399 // Indicates that a kConfigChanged status has been reported by GetNextBuffer() |
| 402 // and GetCurrentXXXDecoderConfig() must be called to update the current | 400 // and GetCurrentXXXDecoderConfig() must be called to update the current |
| 403 // config. GetNextBuffer() must not be called again until | 401 // config. GetNextBuffer() must not be called again until |
| 404 // GetCurrentXXXDecoderConfig() has been called. | 402 // GetCurrentXXXDecoderConfig() has been called. |
| 405 bool config_change_pending_; | 403 bool config_change_pending_; |
| 406 | 404 |
| 407 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when | 405 // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when |
| 408 // a splice frame buffer or buffer with preroll is returned from | 406 // a splice frame buffer or buffer with preroll is returned from |
| 409 // GetNextBufferInternal(). | 407 // GetNextBufferInternal(). |
| 410 scoped_refptr<StreamParserBuffer> pending_buffer_; | 408 scoped_refptr<StreamParserBuffer> pending_buffer_; |
| 411 | 409 |
| 412 // Indicates which of the splice buffers in |splice_buffer_| should be | 410 // Indicates which of the splice buffers in |splice_buffer_| should be |
| 413 // handled out next. | 411 // handled out next. |
| 414 size_t splice_buffers_index_; | 412 size_t splice_buffers_index_; |
| 415 | 413 |
| 416 // Indicates that all buffers before |pending_buffer_| have been handed out. | 414 // Indicates that all buffers before |pending_buffer_| have been handed out. |
| 417 bool pending_buffers_complete_; | 415 bool pending_buffers_complete_; |
| 418 | 416 |
| 419 // Indicates that splice frame generation is enabled. | 417 // Indicates that splice frame generation is enabled. |
| 420 const bool splice_frames_enabled_; | 418 const bool splice_frames_enabled_; |
| 421 | 419 |
| 422 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); | 420 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); |
| 423 }; | 421 }; |
| 424 | 422 |
| 425 } // namespace media | 423 } // namespace media |
| 426 | 424 |
| 427 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ | 425 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ |
| OLD | NEW |