#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/remoting/fake_remoter.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/task/single_thread_task_runner.h"
#include "build/buildflag.h"
#include "media/cast/openscreen/decoder_buffer_reader.h"
#include "media/media_buildflags.h"
#include "media/remoting/renderer_controller.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(ENABLE_MEDIA_REMOTING_RPC)
#include "media/cast/openscreen/remoting_proto_utils.h"
#endif
namespace media {
namespace remoting {
FakeRemotingDataStreamSender::FakeRemotingDataStreamSender(
mojo::PendingReceiver<mojom::RemotingDataStreamSender> stream_sender,
mojo::ScopedDataPipeConsumerHandle consumer_handle)
: … { … }
FakeRemotingDataStreamSender::~FakeRemotingDataStreamSender() = default;
void FakeRemotingDataStreamSender::ResetHistory() { … }
bool FakeRemotingDataStreamSender::ValidateFrameBuffer(size_t index,
size_t size,
bool key_frame,
int pts_ms) { … }
void FakeRemotingDataStreamSender::CloseDataPipe() { … }
void FakeRemotingDataStreamSender::SendFrame(
media::mojom::DecoderBufferPtr buffer,
SendFrameCallback callback) { … }
void FakeRemotingDataStreamSender::OnFrameRead(
scoped_refptr<media::DecoderBuffer> buffer) { … }
void FakeRemotingDataStreamSender::CancelInFlightData() { … }
FakeRemoter::FakeRemoter(mojo::PendingRemote<mojom::RemotingSource> source,
bool start_will_fail)
: … { … }
FakeRemoter::~FakeRemoter() = default;
void FakeRemoter::Start() { … }
void FakeRemoter::StartWithPermissionAlreadyGranted() { … }
void FakeRemoter::StartDataStreams(
mojo::ScopedDataPipeConsumerHandle audio_pipe,
mojo::ScopedDataPipeConsumerHandle video_pipe,
mojo::PendingReceiver<mojom::RemotingDataStreamSender> audio_sender,
mojo::PendingReceiver<mojom::RemotingDataStreamSender> video_sender) { … }
void FakeRemoter::Stop(mojom::RemotingStopReason reason) { … }
void FakeRemoter::SendMessageToSink(const std::vector<uint8_t>& message) { … }
void FakeRemoter::EstimateTransmissionCapacity(
mojom::Remoter::EstimateTransmissionCapacityCallback callback) { … }
void FakeRemoter::Started() { … }
void FakeRemoter::StartFailed() { … }
void FakeRemoter::Stopped(mojom::RemotingStopReason reason) { … }
FakeRemoterFactory::FakeRemoterFactory(bool start_will_fail)
: … { … }
FakeRemoterFactory::~FakeRemoterFactory() = default;
void FakeRemoterFactory::Create(
mojo::PendingRemote<mojom::RemotingSource> source,
mojo::PendingReceiver<mojom::Remoter> receiver) { … }
std::unique_ptr<RendererController> FakeRemoterFactory::CreateController(
bool start_will_fail) { … }
}
}