Chromium Code Reviews| Index: media/remoting/rpc/decoder_buffer_segment.h |
| diff --git a/media/remoting/rpc/decoder_buffer_segment.h b/media/remoting/rpc/decoder_buffer_segment.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4510e220844d49861883fbda43d2b67ab2ea7ea2 |
| --- /dev/null |
| +++ b/media/remoting/rpc/decoder_buffer_segment.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ |
| +#define MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ |
| + |
| +#include <cstdint> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "media/base/decoder_buffer.h" |
| +#include "media/remoting/remoting_rpc_message.pb.h" |
| + |
| +namespace media { |
| +namespace remoting { |
| + |
| +class DecoderBufferSegment |
|
xjz
2016/09/02 18:29:38
Can you add some comments briefly describe this cl
erickung1
2016/09/06 09:37:24
Done.
|
| + : public base::RefCountedThreadSafe<DecoderBufferSegment> { |
| + public: |
| + explicit DecoderBufferSegment( |
| + const scoped_refptr<::media::DecoderBuffer>& decoder_buffer); |
| + |
| + // Converts DecoderBufferSegment into byte array. |
| + uint32_t ToBuffer(std::vector<uint8_t>* buffer); |
|
xjz
2016/09/02 18:29:38
Suggest use a more meaningful name, and use std::s
erickung1
2016/09/06 09:37:24
change it to std::string Serialzie();
miu
2016/09/08 01:07:34
If this string is going to be passed to the Mojo i
|
| + |
| + // Converts byte array into DecoderBufferSegment. |
| + static scoped_refptr<DecoderBufferSegment> FromBuffer(const uint8_t* data, |
|
xjz
2016/09/02 18:29:38
This method creates a new object. Maybe name it Cr
erickung1
2016/09/06 09:37:24
Done.
|
| + uint32_t size); |
| + |
| + scoped_refptr<::media::DecoderBuffer> decoder_buffer() { |
| + return decoder_buffer_; |
| + } |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<DecoderBufferSegment>; |
| + ~DecoderBufferSegment(); |
| + |
| + scoped_refptr<::media::DecoderBuffer> decoder_buffer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DecoderBufferSegment); |
| +}; |
| + |
| +} // namespace remoting |
| +} // namespace media |
| + |
| +#endif // MEDIA_REMOTING_RPC_DECODER_BUFFER_SEGMENT_H_ |