Commit 667093b4 authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Clean up old Mojo type for mojom::FrameResourceReleaser

This CL cleans up old mojo types for mojom::FrameResourceReleaser
with using PendingRemote and MakeSelfOwnedReceiver.

Bug: 955171
Change-Id: I6387a0e48434b7a765ad9867eb7f1655d36755fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928595Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#718018}
parent 62aabb33
...@@ -25,7 +25,8 @@ namespace media { ...@@ -25,7 +25,8 @@ namespace media {
namespace { namespace {
void ReleaseFrameResource(mojom::FrameResourceReleaserPtr releaser) { void ReleaseFrameResource(
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser) {
// Close the connection, which will result in the service realizing the frame // Close the connection, which will result in the service realizing the frame
// resource is no longer needed. // resource is no longer needed.
releaser.reset(); releaser.reset();
...@@ -263,10 +264,11 @@ void MojoDecryptor::OnAudioDecoded( ...@@ -263,10 +264,11 @@ void MojoDecryptor::OnAudioDecoded(
std::move(audio_decode_cb).Run(status, audio_frames); std::move(audio_decode_cb).Run(status, audio_frames);
} }
void MojoDecryptor::OnVideoDecoded(VideoDecodeOnceCB video_decode_cb, void MojoDecryptor::OnVideoDecoded(
Status status, VideoDecodeOnceCB video_decode_cb,
const scoped_refptr<VideoFrame>& video_frame, Status status,
mojom::FrameResourceReleaserPtr releaser) { const scoped_refptr<VideoFrame>& video_frame,
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser) {
DVLOG_IF(1, status != kSuccess) << __func__ << ": status = " << status; DVLOG_IF(1, status != kSuccess) << __func__ << ": status = " << status;
DVLOG_IF(3, status == kSuccess) << __func__; DVLOG_IF(3, status == kSuccess) << __func__;
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "media/base/decryptor.h" #include "media/base/decryptor.h"
#include "media/mojo/mojom/decryptor.mojom.h" #include "media/mojo/mojom/decryptor.mojom.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"
...@@ -78,10 +77,11 @@ class MojoDecryptor : public Decryptor { ...@@ -78,10 +77,11 @@ class MojoDecryptor : public Decryptor {
void OnAudioDecoded(AudioDecodeOnceCB audio_decode_cb, void OnAudioDecoded(AudioDecodeOnceCB audio_decode_cb,
Status status, Status status,
std::vector<mojom::AudioBufferPtr> audio_buffers); std::vector<mojom::AudioBufferPtr> audio_buffers);
void OnVideoDecoded(VideoDecodeOnceCB video_decode_cb, void OnVideoDecoded(
Status status, VideoDecodeOnceCB video_decode_cb,
const scoped_refptr<VideoFrame>& video_frame, Status status,
mojom::FrameResourceReleaserPtr releaser); const scoped_refptr<VideoFrame>& video_frame,
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser);
void OnConnectionError(uint32_t custom_reason, void OnConnectionError(uint32_t custom_reason,
const std::string& description); const std::string& description);
......
...@@ -57,7 +57,9 @@ interface Decryptor { ...@@ -57,7 +57,9 @@ interface Decryptor {
DecryptAndDecodeAudio(DecoderBuffer encrypted) DecryptAndDecodeAudio(DecoderBuffer encrypted)
=> (Status status, array<AudioBuffer> audio_buffers); => (Status status, array<AudioBuffer> audio_buffers);
DecryptAndDecodeVideo(DecoderBuffer encrypted) DecryptAndDecodeVideo(DecoderBuffer encrypted)
=> (Status status, VideoFrame? video_frame, FrameResourceReleaser? releaser); => (Status status,
VideoFrame? video_frame,
pending_remote<FrameResourceReleaser>? releaser);
// Resets the decoder for |stream_type| to a clean initialized state and // Resets the decoder for |stream_type| to a clean initialized state and
// cancels any pending decrypt-and-decode operations immediately with ERROR. // cancels any pending decrypt-and-decode operations immediately with ERROR.
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#include "media/mojo/common/mojo_shared_buffer_video_frame.h" #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/demuxer_stream.mojom.h" #include "media/mojo/mojom/demuxer_stream.mojom.h"
#include "media/mojo/services/mojo_cdm_service_context.h" #include "media/mojo/services/mojo_cdm_service_context.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace media { namespace media {
...@@ -238,7 +239,7 @@ void MojoDecryptorService::OnAudioRead(DecryptAndDecodeAudioCallback callback, ...@@ -238,7 +239,7 @@ void MojoDecryptorService::OnAudioRead(DecryptAndDecodeAudioCallback callback,
void MojoDecryptorService::OnVideoRead(DecryptAndDecodeVideoCallback callback, void MojoDecryptorService::OnVideoRead(DecryptAndDecodeVideoCallback callback,
scoped_refptr<DecoderBuffer> buffer) { scoped_refptr<DecoderBuffer> buffer) {
if (!buffer) { if (!buffer) {
std::move(callback).Run(Status::kError, nullptr, nullptr); std::move(callback).Run(Status::kError, nullptr, mojo::NullRemote());
return; return;
} }
...@@ -278,16 +279,17 @@ void MojoDecryptorService::OnVideoDecoded( ...@@ -278,16 +279,17 @@ void MojoDecryptorService::OnVideoDecoded(
if (!frame) { if (!frame) {
DCHECK_NE(status, Status::kSuccess); DCHECK_NE(status, Status::kSuccess);
std::move(callback).Run(status, nullptr, nullptr); std::move(callback).Run(status, nullptr, mojo::NullRemote());
return; return;
} }
// If |frame| has shared memory that will be passed back, keep the reference // If |frame| has shared memory that will be passed back, keep the reference
// to it until the other side is done with the memory. // to it until the other side is done with the memory.
mojom::FrameResourceReleaserPtr releaser; mojo::PendingRemote<mojom::FrameResourceReleaser> releaser;
if (frame->storage_type() == VideoFrame::STORAGE_MOJO_SHARED_BUFFER) { if (frame->storage_type() == VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {
mojo::MakeStrongBinding(std::make_unique<FrameResourceReleaserImpl>(frame), mojo::MakeSelfOwnedReceiver(
mojo::MakeRequest(&releaser)); std::make_unique<FrameResourceReleaserImpl>(frame),
releaser.InitWithNewPipeAndPassReceiver());
} }
std::move(callback).Run(status, std::move(frame), std::move(releaser)); std::move(callback).Run(status, std::move(frame), std::move(releaser));
......
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