| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // SeekableBuffer to support backward and forward seeking in a buffer for | 5 // SeekableBuffer to support backward and forward seeking in a buffer for |
| 6 // reading a media data source. | 6 // reading a media data source. |
| 7 // | 7 // |
| 8 // In order to support backward and forward seeking, this class buffers data in | 8 // In order to support backward and forward seeking, this class buffers data in |
| 9 // both backward and forward directions, the current read position can be reset | 9 // both backward and forward directions, the current read position can be reset |
| 10 // to anywhere in the buffered data. | 10 // to anywhere in the buffered data. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // Returns the number of bytes buffered that precedes the current read | 97 // Returns the number of bytes buffered that precedes the current read |
| 98 // position. | 98 // position. |
| 99 size_t backward_bytes() const { return backward_bytes_; } | 99 size_t backward_bytes() const { return backward_bytes_; } |
| 100 | 100 |
| 101 // Sets the forward_capacity to |new_forward_capacity| bytes. | 101 // Sets the forward_capacity to |new_forward_capacity| bytes. |
| 102 void set_forward_capacity(size_t new_forward_capacity) { | 102 void set_forward_capacity(size_t new_forward_capacity) { |
| 103 forward_capacity_ = new_forward_capacity; | 103 forward_capacity_ = new_forward_capacity; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Sets the backward_capacity to |new_backward_capacity| bytes. |
| 107 void set_backward_capacity(size_t new_backward_capacity) { |
| 108 backward_capacity_ = new_backward_capacity; |
| 109 } |
| 110 |
| 106 // Returns the maximum number of bytes that should be kept in the forward | 111 // Returns the maximum number of bytes that should be kept in the forward |
| 107 // direction. | 112 // direction. |
| 108 size_t forward_capacity() const { return forward_capacity_; } | 113 size_t forward_capacity() const { return forward_capacity_; } |
| 109 | 114 |
| 110 // Returns the maximum number of bytes that should be kept in the backward | 115 // Returns the maximum number of bytes that should be kept in the backward |
| 111 // direction. | 116 // direction. |
| 112 size_t backward_capacity() const { return backward_capacity_; } | 117 size_t backward_capacity() const { return backward_capacity_; } |
| 113 | 118 |
| 114 // Returns the current timestamp, taking into account current offset. The | 119 // Returns the current timestamp, taking into account current offset. The |
| 115 // value calculated based on the timestamp of the current buffer. If | 120 // value calculated based on the timestamp of the current buffer. If |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // Keeps track of the most recent time we've seen in case the |buffers_| is | 170 // Keeps track of the most recent time we've seen in case the |buffers_| is |
| 166 // empty when our owner asks what time it is. | 171 // empty when our owner asks what time it is. |
| 167 base::TimeDelta current_time_; | 172 base::TimeDelta current_time_; |
| 168 | 173 |
| 169 DISALLOW_COPY_AND_ASSIGN(SeekableBuffer); | 174 DISALLOW_COPY_AND_ASSIGN(SeekableBuffer); |
| 170 }; | 175 }; |
| 171 | 176 |
| 172 } // namespace media | 177 } // namespace media |
| 173 | 178 |
| 174 #endif // MEDIA_BASE_SEEKABLE_BUFFER_H_ | 179 #endif // MEDIA_BASE_SEEKABLE_BUFFER_H_ |
| OLD | NEW |