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( ...@@ -25,8 +25,7 @@ MojoAudioDecoder::MojoAudioDecoder(
: task_runner_(task_runner), : task_runner_(task_runner),
pending_remote_decoder_(std::move(remote_decoder)), pending_remote_decoder_(std::move(remote_decoder)),
writer_capacity_( writer_capacity_(
GetDefaultDecoderBufferConverterCapacity(DemuxerStream::AUDIO)), GetDefaultDecoderBufferConverterCapacity(DemuxerStream::AUDIO)) {
client_binding_(this) {
DVLOG(1) << __func__; DVLOG(1) << __func__;
} }
...@@ -150,10 +149,7 @@ void MojoAudioDecoder::BindRemoteDecoder() { ...@@ -150,10 +149,7 @@ void MojoAudioDecoder::BindRemoteDecoder() {
remote_decoder_.set_disconnect_handler( remote_decoder_.set_disconnect_handler(
base::Bind(&MojoAudioDecoder::OnConnectionError, base::Unretained(this))); base::Bind(&MojoAudioDecoder::OnConnectionError, base::Unretained(this)));
mojom::AudioDecoderClientAssociatedPtrInfo client_ptr_info; remote_decoder_->Construct(client_receiver_.BindNewEndpointAndPassRemote());
client_binding_.Bind(mojo::MakeRequest(&client_ptr_info));
remote_decoder_->Construct(std::move(client_ptr_info));
} }
void MojoAudioDecoder::OnBufferDecoded(mojom::AudioBufferPtr buffer) { void MojoAudioDecoder::OnBufferDecoded(mojom::AudioBufferPtr buffer) {
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
#include "media/base/audio_decoder.h" #include "media/base/audio_decoder.h"
#include "media/mojo/mojom/audio_decoder.mojom.h" #include "media/mojo/mojom/audio_decoder.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h" #include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
...@@ -82,8 +81,8 @@ class MojoAudioDecoder : public AudioDecoder, public mojom::AudioDecoderClient { ...@@ -82,8 +81,8 @@ class MojoAudioDecoder : public AudioDecoder, public mojom::AudioDecoderClient {
uint32_t writer_capacity_ = 0; uint32_t writer_capacity_ = 0;
// Binding for AudioDecoderClient, bound to the |task_runner_|. // Receiver for AudioDecoderClient, bound to the |task_runner_|.
mojo::AssociatedBinding<AudioDecoderClient> client_binding_; mojo::AssociatedReceiver<AudioDecoderClient> client_receiver_{this};
InitCB init_cb_; InitCB init_cb_;
OutputCB output_cb_; OutputCB output_cb_;
......
...@@ -11,7 +11,7 @@ interface AudioDecoder { ...@@ -11,7 +11,7 @@ interface AudioDecoder {
// //
// TODO(sandersd): Rename to Initialize() if/when // TODO(sandersd): Rename to Initialize() if/when
// media::AudioDecoder::Initialize() is renamed to Configure(). // 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. // Initializes the AudioDecoder with the audio codec configuration and CDM id.
// For the unencrypted streams the |cdm_id| is ignored. Executed the callback // For the unencrypted streams the |cdm_id| is ignored. Executed the callback
......
...@@ -27,7 +27,7 @@ MojoAudioDecoderService::MojoAudioDecoderService( ...@@ -27,7 +27,7 @@ MojoAudioDecoderService::MojoAudioDecoderService(
MojoAudioDecoderService::~MojoAudioDecoderService() = default; MojoAudioDecoderService::~MojoAudioDecoderService() = default;
void MojoAudioDecoderService::Construct( void MojoAudioDecoderService::Construct(
mojom::AudioDecoderClientAssociatedPtrInfo client) { mojo::PendingAssociatedRemote<mojom::AudioDecoderClient> client) {
DVLOG(1) << __func__; DVLOG(1) << __func__;
client_.Bind(std::move(client)); client_.Bind(std::move(client));
} }
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "media/base/audio_decoder.h" #include "media/base/audio_decoder.h"
#include "media/mojo/mojom/audio_decoder.mojom.h" #include "media/mojo/mojom/audio_decoder.mojom.h"
#include "media/mojo/services/media_mojo_export.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 { namespace media {
...@@ -29,7 +31,8 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder { ...@@ -29,7 +31,8 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder {
~MojoAudioDecoderService() final; ~MojoAudioDecoderService() final;
// mojom::AudioDecoder implementation // mojom::AudioDecoder implementation
void Construct(mojom::AudioDecoderClientAssociatedPtrInfo client) final; void Construct(
mojo::PendingAssociatedRemote<mojom::AudioDecoderClient> client) final;
void Initialize(const AudioDecoderConfig& config, void Initialize(const AudioDecoderConfig& config,
int32_t cdm_id, int32_t cdm_id,
InitializeCallback callback) final; InitializeCallback callback) final;
...@@ -69,7 +72,7 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder { ...@@ -69,7 +72,7 @@ class MEDIA_MOJO_EXPORT MojoAudioDecoderService : public mojom::AudioDecoder {
MojoCdmServiceContext* const mojo_cdm_service_context_ = nullptr; MojoCdmServiceContext* const mojo_cdm_service_context_ = nullptr;
// The destination for the decoded buffers. // 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 // Holds the CdmContextRef to keep the CdmContext alive for the lifetime of
// the |decoder_|. // 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