Commit 0adc0178 authored by timav's avatar timav Committed by Commit bot

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}
parent ed07b377
...@@ -18,7 +18,7 @@ interface AudioDecoder { ...@@ -18,7 +18,7 @@ interface AudioDecoder {
// For the unencrypted streams the |cdm_id| is ignored. Executed the callback // For the unencrypted streams the |cdm_id| is ignored. Executed the callback
// with whether the initialization succeeded, and whether the pipeline needs // with whether the initialization succeeded, and whether the pipeline needs
// bitstream conversion. // bitstream conversion.
Initialize(AudioDecoderConfig config, int32 cdm_id) Initialize(AudioDecoderClient client, AudioDecoderConfig config, int32 cdm_id)
=> (bool success, bool needs_bitstream_conversion); => (bool success, bool needs_bitstream_conversion);
// Sends the |buffer| to the underlying codec. Should be called only after // Sends the |buffer| to the underlying codec. Should be called only after
......
...@@ -124,6 +124,23 @@ source_set("cdm_service") { ...@@ -124,6 +124,23 @@ source_set("cdm_service") {
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] 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") { source_set("renderer_service") {
sources = [ sources = [
"demuxer_stream_provider_shim.cc", "demuxer_stream_provider_shim.cc",
...@@ -158,6 +175,7 @@ source_set("application") { ...@@ -158,6 +175,7 @@ source_set("application") {
public_configs = [ ":mojo_media_config" ] public_configs = [ ":mojo_media_config" ]
deps = [ deps = [
":audio_decoder_service",
":cdm_service", ":cdm_service",
":renderer_service", ":renderer_service",
"//base", "//base",
......
// 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
// 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_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment