#include "components/cast_streaming/browser/control/playback_command_dispatcher.h"
#include "base/functional/bind.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "components/cast_streaming/browser/control/remoting/renderer_rpc_call_translator.h"
#include "media/cast/openscreen/rpc_call_message_handler.h"
#include "media/mojo/mojom/renderer.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace cast_streaming {
namespace {
bool IsValidAudioCodec(
const media::AudioDecoderConfig config,
const ReceiverConfig::RemotingConstraints& remoting_constraints) { … }
}
PlaybackCommandDispatcher::PlaybackCommandDispatcher(
scoped_refptr<base::SequencedTaskRunner> task_runner,
mojo::AssociatedRemote<mojom::RendererController> control_configuration,
remoting::RendererRpcCallTranslator::FlushUntilCallback flush_until_cb,
std::optional<ReceiverConfig::RemotingConstraints> remoting_constraints)
: … { … }
PlaybackCommandDispatcher::~PlaybackCommandDispatcher() { … }
void PlaybackCommandDispatcher::RegisterCommandSource(
mojo::PendingReceiver<media::mojom::Renderer> controls) { … }
void PlaybackCommandDispatcher::Flush(
media::mojom::Renderer::FlushCallback callback) { … }
void PlaybackCommandDispatcher::TryStartPlayback(base::TimeDelta timestamp) { … }
void PlaybackCommandDispatcher::OnRemotingSessionNegotiated(
openscreen::cast::RpcMessenger* messenger) { … }
void PlaybackCommandDispatcher::ConfigureRemotingAsync(
Dispatcher* dispatcher,
const openscreen::cast::ReceiverSession* session,
openscreen::cast::ReceiverSession::ConfiguredReceivers receivers) { … }
void PlaybackCommandDispatcher::OnRemotingSessionEnded() { … }
void PlaybackCommandDispatcher::SendRemotingRpcMessageToRemote(
openscreen::cast::RpcMessenger::Handle handle,
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void PlaybackCommandDispatcher::ProcessRemotingRpcMessageFromRemote(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
openscreen::cast::RpcMessenger::Handle
PlaybackCommandDispatcher::AcquireHandle() { … }
void PlaybackCommandDispatcher::RegisterHandleForCallbacks(
openscreen::cast::RpcMessenger::Handle handle) { … }
void PlaybackCommandDispatcher::OnSetPlaybackControllerDone() { … }
void PlaybackCommandDispatcher::RpcAcquireRendererAsync(
openscreen::cast::RpcMessenger::Handle remote_handle,
AcquireRendererCB cb) { … }
void PlaybackCommandDispatcher::OnRpcAcquireDemuxer(
openscreen::cast::RpcMessenger::Handle audio_stream_handle,
openscreen::cast::RpcMessenger::Handle video_stream_handle) { … }
void PlaybackCommandDispatcher::OnNewAudioConfig(
media::AudioDecoderConfig config) { … }
void PlaybackCommandDispatcher::OnNewVideoConfig(
media::VideoDecoderConfig config) { … }
void PlaybackCommandDispatcher::MaybeStartStreamingSession() { … }
}