summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authortimav <timav@chromium.org>2016-03-16 15:54:14 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-16 23:00:18 +0000
commit0adc0178a182e7ab2d74f729bc70987c6c5b9234 (patch)
treecc7e3b14a81e6579943bc37cb9fd628003b3d775 /media
parented07b3773e3aad4a44a79a48c17162ef57ca82ee (diff)
downloadchromium_src-0adc0178a182e7ab2d74f729bc70987c6c5b9234.zip
chromium_src-0adc0178a182e7ab2d74f729bc70987c6c5b9234.tar.gz
chromium_src-0adc0178a182e7ab2d74f729bc70987c6c5b9234.tar.bz2
Add a stub implementation for Mojo AudioDecoder interface
This CL adds a stub service that implements interface::AudioDecoder. The interface is modified to pass the AudioDecoderClient which can transfer the results back to the proxy. BUG=542910 Review URL: https://codereview.chromium.org/1808593002 Cr-Commit-Position: refs/heads/master@{#381574}
Diffstat (limited to 'media')
-rw-r--r--media/mojo/interfaces/audio_decoder.mojom2
-rw-r--r--media/mojo/services/BUILD.gn18
-rw-r--r--media/mojo/services/mojo_audio_decoder_service.cc37
-rw-r--r--media/mojo/services/mojo_audio_decoder_service.h50
4 files changed, 106 insertions, 1 deletions
diff --git a/media/mojo/interfaces/audio_decoder.mojom b/media/mojo/interfaces/audio_decoder.mojom
index 7601ba0..bb4f059 100644
--- a/media/mojo/interfaces/audio_decoder.mojom
+++ b/media/mojo/interfaces/audio_decoder.mojom
@@ -18,7 +18,7 @@ interface AudioDecoder {
// For the unencrypted streams the |cdm_id| is ignored. Executed the callback
// with whether the initialization succeeded, and whether the pipeline needs
// bitstream conversion.
- Initialize(AudioDecoderConfig config, int32 cdm_id)
+ Initialize(AudioDecoderClient client, AudioDecoderConfig config, int32 cdm_id)
=> (bool success, bool needs_bitstream_conversion);
// Sends the |buffer| to the underlying codec. Should be called only after
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn
index d559326..c917069 100644
--- a/media/mojo/services/BUILD.gn
+++ b/media/mojo/services/BUILD.gn
@@ -124,6 +124,23 @@ source_set("cdm_service") {
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
}
+source_set("audio_decoder_service") {
+ sources = [
+ "mojo_audio_decoder_service.cc",
+ "mojo_audio_decoder_service.h",
+ ]
+
+ deps = [
+ ":cdm_service",
+ "//base",
+ "//media",
+ "//media:shared_memory_support",
+ "//media/mojo/common",
+ "//media/mojo/interfaces",
+ "//mojo/common",
+ ]
+}
+
source_set("renderer_service") {
sources = [
"demuxer_stream_provider_shim.cc",
@@ -158,6 +175,7 @@ source_set("application") {
public_configs = [ ":mojo_media_config" ]
deps = [
+ ":audio_decoder_service",
":cdm_service",
":renderer_service",
"//base",
diff --git a/media/mojo/services/mojo_audio_decoder_service.cc b/media/mojo/services/mojo_audio_decoder_service.cc
new file mode 100644
index 0000000..bf2c661
--- /dev/null
+++ b/media/mojo/services/mojo_audio_decoder_service.cc
@@ -0,0 +1,37 @@
+// 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.
+
+#include "base/logging.h"
+#include "media/mojo/services/mojo_audio_decoder_service.h"
+
+namespace media {
+
+MojoAudioDecoderService::MojoAudioDecoderService(
+ scoped_ptr<AudioDecoder> decoder,
+ mojo::InterfaceRequest<interfaces::AudioDecoder> request)
+ : binding_(this, std::move(request)), decoder_(std::move(decoder)) {}
+
+MojoAudioDecoderService::~MojoAudioDecoderService() {}
+
+void MojoAudioDecoderService::Initialize(
+ interfaces::AudioDecoderClientPtr client,
+ interfaces::AudioDecoderConfigPtr config,
+ int32_t cdm_id,
+ const InitializeCallback& callback) {
+ NOTIMPLEMENTED();
+ callback.Run(false, false);
+}
+
+void MojoAudioDecoderService::Decode(interfaces::DecoderBufferPtr buffer,
+ const DecodeCallback& callback) {
+ NOTIMPLEMENTED();
+ callback.Run(DecodeStatus::DECODE_ERROR);
+}
+
+void MojoAudioDecoderService::Reset(const ResetCallback& callback) {
+ NOTIMPLEMENTED();
+ callback.Run();
+}
+
+} // namespace media
diff --git a/media/mojo/services/mojo_audio_decoder_service.h b/media/mojo/services/mojo_audio_decoder_service.h
new file mode 100644
index 0000000..10f13f3
--- /dev/null
+++ b/media/mojo/services/mojo_audio_decoder_service.h
@@ -0,0 +1,50 @@
+// 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_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
+#define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "media/mojo/interfaces/audio_decoder.mojom.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace media {
+
+class MojoAudioDecoderService : public interfaces::AudioDecoder {
+ public:
+ MojoAudioDecoderService(
+ scoped_ptr<AudioDecoder> decoder,
+ mojo::InterfaceRequest<interfaces::AudioDecoder> request);
+
+ ~MojoAudioDecoderService() final;
+
+ // interfaces::AudioDecoder implementation
+ void Initialize(interfaces::AudioDecoderClientPtr client,
+ interfaces::AudioDecoderConfigPtr config,
+ int32_t cdm_id,
+ const InitializeCallback& callback) final;
+
+ void Decode(interfaces::DecoderBufferPtr buffer,
+ const DecodeCallback& callback) final;
+
+ void Reset(const ResetCallback& callback) final;
+
+ private:
+ // A binding represents the association between the service and the
+ // communication channel, i.e. the pipe.
+ mojo::StrongBinding<interfaces::AudioDecoder> binding_;
+
+ // The AudioDecoder that does actual decoding work.
+ scoped_ptr<AudioDecoder> decoder_;
+
+ // The destination for the decoded buffers.
+ interfaces::AudioDecoderClientPtr client_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService);
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_