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

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

Issue 2640003002: Implement MojoAudioRendererSink and use it in UtilityMojoMediaClient (Closed)
Patch Set: Rebase Created 3 years, 10 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 | « media/mojo/common/media_type_converters.h ('k') | media/mojo/interfaces/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/common/media_type_converters.cc
diff --git a/media/mojo/common/media_type_converters.cc b/media/mojo/common/media_type_converters.cc
index 33842624ebd8dbb720a6eca8027b498a8f17aff5..516dd1ac518d00ef80798ac051733e34fe81cfd1 100644
--- a/media/mojo/common/media_type_converters.cc
+++ b/media/mojo/common/media_type_converters.cc
@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "media/base/audio_buffer.h"
+#include "media/base/audio_bus.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/cdm_config.h"
#include "media/base/cdm_key_information.h"
@@ -322,6 +323,23 @@ TypeConverter<scoped_refptr<media::AudioBuffer>, media::mojom::AudioBufferPtr>::
}
// static
+media::mojom::AudioBusPtr
+TypeConverter<media::mojom::AudioBusPtr, media::AudioBus>::Convert(
+ const media::AudioBus& input) {
+ media::mojom::AudioBusPtr buffer(media::mojom::AudioBus::New());
+ buffer->nb_channels = input.channels();
+ buffer->nb_frames = input.frames();
+
+ if (input.data_) {
+ DCHECK_GT(input.data_size_, 0u);
+ buffer->data.assign(input.data_.get(),
+ input.data_.get() + input.data_size_);
+ }
+
+ return buffer;
+}
+
+// static
media::mojom::VideoFramePtr
TypeConverter<media::mojom::VideoFramePtr, scoped_refptr<media::VideoFrame>>::
Convert(const scoped_refptr<media::VideoFrame>& input) {
« no previous file with comments | « media/mojo/common/media_type_converters.h ('k') | media/mojo/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698