Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: media/base/seekable_buffer.h

Issue 2008010: Fixes in AlsaPcmOutputStream. (Closed)
Patch Set: - Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // position. Returns the number of bytes read. 57 // position. Returns the number of bytes read.
58 // The current read position will advance by the amount of bytes read. If 58 // The current read position will advance by the amount of bytes read. If
59 // reading caused backward_bytes() to exceed backward_capacity(), an eviction 59 // reading caused backward_bytes() to exceed backward_capacity(), an eviction
60 // of the backward buffer will be done internally. 60 // of the backward buffer will be done internally.
61 size_t Read(uint8* data, size_t size); 61 size_t Read(uint8* data, size_t size);
62 62
63 // Copies up to |size| bytes from current position to |data|. Returns 63 // Copies up to |size| bytes from current position to |data|. Returns
64 // number of bytes copied. Doesn't advance current position. 64 // number of bytes copied. Doesn't advance current position.
65 size_t Peek(uint8* data, size_t size); 65 size_t Peek(uint8* data, size_t size);
66 66
67 // Returns pointer to the current chunk of data that is being consumed.
68 // If there is no data left in the buffer false is returned, otherwise
69 // true is returned and |data| and |size| are updated. The returned
70 // |data| value becomes invalid when Read(), Append() or Seek()
71 // are called.
72 bool GetCurrentChunk(const uint8** data, size_t* size) const;
73
67 // Appends |buffer_in| to this buffer. Returns false if forward_bytes() is 74 // Appends |buffer_in| to this buffer. Returns false if forward_bytes() is
68 // greater than or equals to forward_capacity(), true otherwise. The data 75 // greater than or equals to forward_capacity(), true otherwise. The data
69 // is added to the buffer in any case. 76 // is added to the buffer in any case.
70 bool Append(Buffer* buffer_in); 77 bool Append(Buffer* buffer_in);
71 78
72 // Appends |size| bytes of |data| to the buffer. Result is the same 79 // Appends |size| bytes of |data| to the buffer. Result is the same
73 // as for Append(Buffer*). 80 // as for Append(Buffer*).
74 bool Append(const uint8* data, size_t size); 81 bool Append(const uint8* data, size_t size);
75 82
76 // Moves the read position by |offset| bytes. If |offset| is positive, the 83 // Moves the read position by |offset| bytes. If |offset| is positive, the
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Keeps track of the most recent time we've seen in case the |buffers_| is 162 // Keeps track of the most recent time we've seen in case the |buffers_| is
156 // empty when our owner asks what time it is. 163 // empty when our owner asks what time it is.
157 base::TimeDelta current_time_; 164 base::TimeDelta current_time_;
158 165
159 DISALLOW_COPY_AND_ASSIGN(SeekableBuffer); 166 DISALLOW_COPY_AND_ASSIGN(SeekableBuffer);
160 }; 167 };
161 168
162 } // namespace media 169 } // namespace media
163 170
164 #endif // MEDIA_BASE_SEEKABLE_BUFFER_H_ 171 #endif // MEDIA_BASE_SEEKABLE_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698