#include "media/remoting/end2end_test_renderer.h"
#include "base/memory/raw_ptr.h"
#include <memory>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h"
#include "media/cast/openscreen/decoder_buffer_reader.h"
#include "media/cast/openscreen/remoting_proto_utils.h"
#include "media/mojo/common/mojo_data_pipe_read_write.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "media/mojo/mojom/remoting.mojom.h"
#include "media/remoting/courier_renderer.h"
#include "media/remoting/receiver.h"
#include "media/remoting/receiver_controller.h"
#include "media/remoting/renderer_controller.h"
#include "media/remoting/stream_provider.h"
#include "media/remoting/test_utils.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/system/data_pipe.h"
RpcMessenger;
namespace media {
namespace remoting {
namespace {
class TestStreamSender final : public mojom::RemotingDataStreamSender { … };
class TestRemoter final : public mojom::Remoter { … };
std::unique_ptr<RendererController> CreateController(
TestRemoter::SendMessageToSinkCallback send_message_to_sink_cb,
TestStreamSender::SendFrameToSinkCallback send_frame_to_sink_cb) { … }
}
class End2EndTestRenderer::TestRemotee : public mojom::Remotee { … };
End2EndTestRenderer::End2EndTestRenderer(std::unique_ptr<Renderer> renderer)
: … { … }
End2EndTestRenderer::~End2EndTestRenderer() { … }
void End2EndTestRenderer::Initialize(MediaResource* media_resource,
RendererClient* client,
PipelineStatusCallback init_cb) { … }
void End2EndTestRenderer::InitializeReceiverRenderer(PipelineStatus status) { … }
void End2EndTestRenderer::OnCourierRendererInitialized(PipelineStatus status) { … }
void End2EndTestRenderer::OnReceiverInitialized(PipelineStatus status) { … }
void End2EndTestRenderer::CompleteInitialize() { … }
void End2EndTestRenderer::OnReceivedRpc(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void End2EndTestRenderer::OnAcquireRenderer(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void End2EndTestRenderer::OnAcquireRendererDone(int receiver_renderer_handle) { … }
void End2EndTestRenderer::SetLatencyHint(
std::optional<base::TimeDelta> latency_hint) { … }
void End2EndTestRenderer::SetPreservesPitch(bool preserves_pitch) { … }
void End2EndTestRenderer::Flush(base::OnceClosure flush_cb) { … }
void End2EndTestRenderer::StartPlayingFrom(base::TimeDelta time) { … }
void End2EndTestRenderer::SetPlaybackRate(double playback_rate) { … }
void End2EndTestRenderer::SetVolume(float volume) { … }
base::TimeDelta End2EndTestRenderer::GetMediaTime() { … }
RendererType End2EndTestRenderer::GetRendererType() { … }
void End2EndTestRenderer::SendMessageToSink(
const std::vector<uint8_t>& message) { … }
void End2EndTestRenderer::SendFrameToSink(
uint32_t frame_count,
scoped_refptr<media::DecoderBuffer> decoder_buffer,
DemuxerStream::Type type) { … }
void End2EndTestRenderer::OnMessageFromSink(
std::unique_ptr<std::vector<uint8_t>> message) { … }
void End2EndTestRenderer::OnSelectedVideoTracksChanged(
const std::vector<DemuxerStream*>& enabled_tracks,
base::OnceClosure change_completed_cb) { … }
void End2EndTestRenderer::OnEnabledAudioTracksChanged(
const std::vector<DemuxerStream*>& enabled_tracks,
base::OnceClosure change_completed_cb) { … }
}
}