| OLD | NEW |
| 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 // 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Clears the buffer, and initializes it with the interval from |buffer| | 77 // Clears the buffer, and initializes it with the interval from |buffer| |
| 78 // starting at |start| and ending at |end|. The data itself isn't copied. | 78 // starting at |start| and ending at |end|. The data itself isn't copied. |
| 79 void CopyFrom(const CompoundBuffer& source, int start, int end); | 79 void CopyFrom(const CompoundBuffer& source, int start, int end); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 friend class CompoundBufferInputStream; | 82 friend class CompoundBufferInputStream; |
| 83 | 83 |
| 84 struct DataChunk { | 84 struct DataChunk { |
| 85 DataChunk(net::IOBuffer* buffer, const char* start, int size); | 85 DataChunk(net::IOBuffer* buffer, const char* start, int size); |
| 86 ~DataChunk(); |
| 86 | 87 |
| 87 scoped_refptr<net::IOBuffer> buffer; | 88 scoped_refptr<net::IOBuffer> buffer; |
| 88 const char* start; | 89 const char* start; |
| 89 int size; | 90 int size; |
| 90 }; | 91 }; |
| 91 typedef std::deque<DataChunk> DataChunkList; | 92 typedef std::deque<DataChunk> DataChunkList; |
| 92 | 93 |
| 93 DataChunkList chunks_; | 94 DataChunkList chunks_; |
| 94 int total_bytes_; | 95 int total_bytes_; |
| 95 bool locked_; | 96 bool locked_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 size_t current_chunk_; | 117 size_t current_chunk_; |
| 117 int current_chunk_position_; | 118 int current_chunk_position_; |
| 118 int position_; | 119 int position_; |
| 119 int last_returned_size_; | 120 int last_returned_size_; |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace remoting | 123 } // namespace remoting |
| 123 | 124 |
| 124 #endif // REMOTING_BASE_COMPOUND_BUFFER_H_ | 125 #endif // REMOTING_BASE_COMPOUND_BUFFER_H_ |
| OLD | NEW |