Chromium Code Reviews| 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 // CompoundBuffer implements a data buffer that is composed of several pieces, | 5 // CompoundBuffer implements a data buffer that is composed of several pieces, |
| 6 // each stored in a refcounted IOBuffer. It is needed for encoding/decoding | 6 // each stored in a refcounted IOBuffer. It is needed for encoding/decoding |
| 7 // video pipeline to represent data packet and minimize data copying. | 7 // video pipeline to represent data packet and minimize data copying. |
| 8 // It is particularly useful for splitting data between multiple RTP packets | 8 // It is particularly useful for splitting data between multiple RTP packets |
| 9 // and assembling them into one buffer on the receiving side. | 9 // and assembling them into one buffer on the receiving side. |
| 10 // | 10 // |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 void Append(net::IOBuffer* buffer, const char* start, int size); | 45 void Append(net::IOBuffer* buffer, const char* start, int size); |
| 46 void Append(const CompoundBuffer& buffer); | 46 void Append(const CompoundBuffer& buffer); |
| 47 void Prepend(net::IOBuffer* buffer, int size); | 47 void Prepend(net::IOBuffer* buffer, int size); |
| 48 void Prepend(net::IOBuffer* buffer, const char* start, int size); | 48 void Prepend(net::IOBuffer* buffer, const char* start, int size); |
| 49 void Prepend(const CompoundBuffer& buffer); | 49 void Prepend(const CompoundBuffer& buffer); |
| 50 | 50 |
| 51 // Same as above, but creates new IOBuffer and copies the data. | 51 // Same as above, but creates new IOBuffer and copies the data. |
| 52 void AppendCopyOf(const char* data, int data_size); | 52 void AppendCopyOf(const char* data, int data_size); |
| 53 void PrependCopyOf(const char* data, int data_size); | 53 void PrependCopyOf(const char* data, int data_size); |
| 54 | 54 |
| 55 // Copies |buffer_size| bytes to buffer and crops them. | |
|
dcaiafa
2015/08/10 23:31:35
Not implemented. Delete?
Sergey Ulanov
2015/08/11 21:34:00
Done.
| |
| 56 void CopyAndCropFront(char* buffer, int buffer_size); | |
| 57 | |
| 55 // Drop |bytes| bytes from the beginning or the end of the buffer. | 58 // Drop |bytes| bytes from the beginning or the end of the buffer. |
| 56 void CropFront(int bytes); | 59 void CropFront(int bytes); |
| 57 void CropBack(int bytes); | 60 void CropBack(int bytes); |
| 58 | 61 |
| 59 // Current size of the buffer. | 62 // Current size of the buffer. |
| 60 int total_bytes() const { return total_bytes_; } | 63 int total_bytes() const { return total_bytes_; } |
| 61 | 64 |
| 62 // Locks the buffer. After the buffer is locked, no data can be | 65 // Locks the buffer. After the buffer is locked, no data can be |
| 63 // added or removed (content can still be changed if some other | 66 // added or removed (content can still be changed if some other |
| 64 // object holds reference to the IOBuffer objects). | 67 // object holds reference to the IOBuffer objects). |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 121 |
| 119 size_t current_chunk_; | 122 size_t current_chunk_; |
| 120 int current_chunk_position_; | 123 int current_chunk_position_; |
| 121 int position_; | 124 int position_; |
| 122 int last_returned_size_; | 125 int last_returned_size_; |
| 123 }; | 126 }; |
| 124 | 127 |
| 125 } // namespace remoting | 128 } // namespace remoting |
| 126 | 129 |
| 127 #endif // REMOTING_BASE_COMPOUND_BUFFER_H_ | 130 #endif // REMOTING_BASE_COMPOUND_BUFFER_H_ |
| OLD | NEW |