OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #include "media/mojo/common/mojo_decoder_buffer_converter.h" | 5 #include "media/mojo/common/mojo_decoder_buffer_converter.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Video can get quite large; at 4K, VP9 delivers packets which are ~1MB in | 32 // Video can get quite large; at 4K, VP9 delivers packets which are ~1MB in |
33 // size; so allow for some head room. | 33 // size; so allow for some head room. |
34 // TODO(xhwang, sandersd): Provide a better way to customize this value. | 34 // TODO(xhwang, sandersd): Provide a better way to customize this value. |
35 options.capacity_num_bytes = 2 * (1024 * 1024); | 35 options.capacity_num_bytes = 2 * (1024 * 1024); |
36 } else { | 36 } else { |
37 NOTREACHED() << "Unsupported type: " << type; | 37 NOTREACHED() << "Unsupported type: " << type; |
38 // Choose an arbitrary size. | 38 // Choose an arbitrary size. |
39 options.capacity_num_bytes = 512 * 1024; | 39 options.capacity_num_bytes = 512 * 1024; |
40 } | 40 } |
41 | 41 |
42 return base::WrapUnique(new mojo::DataPipe(options)); | 42 return base::MakeUnique<mojo::DataPipe>(options); |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 // MojoDecoderBufferReader | 47 // MojoDecoderBufferReader |
48 | 48 |
49 // static | 49 // static |
50 std::unique_ptr<MojoDecoderBufferReader> MojoDecoderBufferReader::Create( | 50 std::unique_ptr<MojoDecoderBufferReader> MojoDecoderBufferReader::Create( |
51 DemuxerStream::Type type, | 51 DemuxerStream::Type type, |
52 mojo::ScopedDataPipeProducerHandle* producer_handle) { | 52 mojo::ScopedDataPipeProducerHandle* producer_handle) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); | 144 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); |
145 if (result != MOJO_RESULT_OK || num_bytes != media_buffer->data_size()) { | 145 if (result != MOJO_RESULT_OK || num_bytes != media_buffer->data_size()) { |
146 DVLOG(1) << __FUNCTION__ << ": writing to data pipe failed"; | 146 DVLOG(1) << __FUNCTION__ << ": writing to data pipe failed"; |
147 return nullptr; | 147 return nullptr; |
148 } | 148 } |
149 | 149 |
150 return buffer; | 150 return buffer; |
151 } | 151 } |
152 | 152 |
153 } // namespace media | 153 } // namespace media |
OLD | NEW |