Commit 593ab87a authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert AudioDecoderClient to new Mojo types

This CL converts AudioDecoderClient{AssociatedPtr,
AssociatedPtrInfo} and AssociatedReceiver<AudioDecoderClient> in
media to the new Mojo type, and uses
pending_associated_remote<AudioDecoderClient> in audio_decoder.mojom.

Bug: 955171
Change-Id: I0639e2bbbd97b0f5aebc958a739dae4e1769240f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865162
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#707290}
parent 629bd797
......@@ -25,8 +25,7 @@ MojoAudioDecoder::MojoAudioDecoder(
: task_runner_(task_runner),
pending_remote_decoder_(std::move(remote_decoder)),
writer_capacity_(
GetDefaultDecoderBufferConverterCapacity(DemuxerStream::AUDIO)),
client_binding_(this) {
GetDefaultDecoderBufferConverterCapacity(DemuxerStream::AUDIO)) {
DVLOG(1) << __func__;
}
......@@ -150,10 +149,7 @@ void MojoAudioDecoder::BindRemoteDecoder() {
remote_decoder_.set_disconnect_handler(
base::Bind(&MojoAudioDecoder::OnConnectionError, base::Unretained(this)));
mojom::AudioDecoderClientAssociatedPtrInfo client_ptr_info;
client_binding_.Bind(mojo::MakeRequest(&client_ptr_info));
remote_decoder_->Construct(std::move(client_ptr_info));
remote_decoder_->Construct(client_receiver_.BindNewEndpointAndPassRemote());
}
void MojoAudioDecoder::OnBufferDecoded(mojom::AudioBufferPtr buffer) {
......
......@@ -12,8 +12,7 @@
#include "media/base/audio_decoder.h"
#include "media/mojo/mojom/audio_decoder.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
......@@ -82,8 +81,8 @@ class MojoAudioDecoder : public AudioDecoder, public mojom::AudioDecoderClient {
uint32_t writer_capacity_ = 0;
// Binding for AudioDecoderClient, bound to the |task_runner_|.
mojo::AssociatedBinding<AudioDecoderClient> client_binding_;
// Receiver for AudioDecoderClient, bound to the |task_runner_|.
mojo::AssociatedReceiver<AudioDecoderClient> client_receiver_{this};
InitCB init_cb_;
OutputCB output_cb_;
......
......@@ -11,7 +11,7 @@ interface AudioDecoder {
//
// TODO(sandersd): Rename to Initialize() if/when
// media::AudioDecoder::Initialize() is renamed to Configure().
Construct(associated AudioDecoderClient client);
Construct(pending_associated_remote<AudioDecoderClient> client);
// Initializes the AudioDecoder with the audio codec configuration and CDM id.
// For the unencrypted streams the |cdm_id| is ignored. Executed the callback
......
......@@ -27,7 +27,7 @@ MojoAudioDecoderService::MojoAudioDecoderService(
MojoAudioDecoderService::~MojoAudioDecoderService() = default;
void MojoAudioDecoderService::Construct(
mojom::AudioDecoderClientAssociatedPtrInfo client) {
mojo::PendingAssociatedRemote<mojom::AudioDecoderClient> client) {
DVLOG(1) << __func__;
client_.Bind(std::move(client));
}
......
......@@ -14,6 +14,8 @@
#include "media/base/audio_decoder.h"
#include "media/mojo/mojom/audio_decoder.mojom.h"
#include "media/mojo/services/media_mojo_export.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
namespace media {
......@@ -29,7 +31,8 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder {
~MojoAudioDecoderService() final;
// mojom::AudioDecoder implementation
void Construct(mojom::AudioDecoderClientAssociatedPtrInfo client) final;
void Construct(
mojo::PendingAssociatedRemote<mojom::AudioDecoderClient> client) final;
void Initialize(const AudioDecoderConfig& config,
int32_t cdm_id,
InitializeCallback callback) final;
......@@ -69,7 +72,7 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder {
MojoCdmServiceContext* const mojo_cdm_service_context_ = nullptr;
// The destination for the decoded buffers.
mojom::AudioDecoderClientAssociatedPtr client_;
mojo::AssociatedRemote<mojom::AudioDecoderClient> client_;
// Holds the CdmContextRef to keep the CdmContext alive for the lifetime of
// the |decoder_|.
......
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