Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1320)

Unified Diff: media/mojo/common/mojo_decoder_buffer_converter.cc

Issue 2875143002: Reduce boilerplate when creating simple mojom::URLLoaders. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/network/url_loader_impl.cc ('k') | media/mojo/common/mojo_decoder_buffer_converter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/common/mojo_decoder_buffer_converter.cc
diff --git a/media/mojo/common/mojo_decoder_buffer_converter.cc b/media/mojo/common/mojo_decoder_buffer_converter.cc
index d47e5f56a67644b34719a05660029b385dd34a8a..91fcbf8bb9c52661503bfdea8ca60615ff3a0708 100644
--- a/media/mojo/common/mojo_decoder_buffer_converter.cc
+++ b/media/mojo/common/mojo_decoder_buffer_converter.cc
@@ -20,26 +20,23 @@ namespace media {
namespace {
std::unique_ptr<mojo::DataPipe> CreateDataPipe(DemuxerStream::Type type) {
- MojoCreateDataPipeOptions options;
- options.struct_size = sizeof(MojoCreateDataPipeOptions);
- options.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE;
- options.element_num_bytes = 1;
+ uint32_t capacity = 0;
if (type == DemuxerStream::AUDIO) {
// TODO(timav): Consider capacity calculation based on AudioDecoderConfig.
- options.capacity_num_bytes = 512 * 1024;
+ capacity = 512 * 1024;
} else if (type == DemuxerStream::VIDEO) {
// Video can get quite large; at 4K, VP9 delivers packets which are ~1MB in
// size; so allow for some head room.
// TODO(xhwang, sandersd): Provide a better way to customize this value.
- options.capacity_num_bytes = 2 * (1024 * 1024);
+ capacity = 2 * (1024 * 1024);
} else {
NOTREACHED() << "Unsupported type: " << type;
// Choose an arbitrary size.
- options.capacity_num_bytes = 512 * 1024;
+ capacity = 512 * 1024;
}
- return base::MakeUnique<mojo::DataPipe>(options);
+ return base::MakeUnique<mojo::DataPipe>(capacity);
}
bool IsPipeReadWriteError(MojoResult result) {
« no previous file with comments | « content/network/url_loader_impl.cc ('k') | media/mojo/common/mojo_decoder_buffer_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698