Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ | |
| 6 #define MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ | |
| 7 | |
| 8 #include <cstdint> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "media/base/decoder_buffer.h" | |
| 15 | |
| 16 namespace media { | |
| 17 namespace remoting { | |
| 18 | |
| 19 // Utility class to serialize and de-serialize between media::DecoderBuffer and | |
| 20 // byte array. The idea is to serialize media::DecoderBuffer except for actual | |
| 21 // decoder buffer using proto buffer and append the decoder buffer at the end. | |
| 22 // into byte array for data transmission. | |
| 23 // | |
| 24 // DecoderBufferSegment { | |
| 25 // // Payload version. Default value is 0. | |
| 26 // u8 payload_version; | |
| 27 // | |
| 28 // // Length of protobuf-encoded media::DecoderBuffer(except for data). | |
| 29 // u16 buffer_segment_size; | |
| 30 // // Protobuf-encoded media::DecoderBuffer. | |
| 31 // u8[buffer_segment_size] buffer_segment; | |
| 32 // | |
| 33 // // Length of data in media::DecoderBuffer. | |
| 34 // u32 data_buffer_size; | |
| 35 // // media::DecoderBuffer data. | |
| 36 // u8[data_buffer_size] data_buffer; | |
| 37 //}; | |
| 38 | |
| 39 // Converts DecoderBufferSegment into byte array. | |
| 40 std::vector<uint8_t> DecoderBufferToByteArray( | |
| 41 const scoped_refptr<::media::DecoderBuffer> decoder_buffer); | |
|
miu
2016/09/13 05:40:57
nit: Please pass by const-ref: const ::media::Deco
erickung1
2016/09/15 02:13:33
Done.
| |
| 42 | |
| 43 // Converts byte array into DecoderBufferSegment. | |
| 44 scoped_refptr<::media::DecoderBuffer> ByteArrayToDecoderBuffer( | |
| 45 const uint8_t* data, | |
| 46 uint32_t size); | |
| 47 | |
| 48 } // namespace remoting | |
| 49 } // namespace media | |
| 50 | |
| 51 #endif // MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ | |
| OLD | NEW |