#include "components/cast_streaming/browser/control/remoting/rpc_demuxer_stream_handler.h"
#include <sstream>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/task/sequenced_task_runner.h"
#include "media/cast/openscreen/remoting_message_factories.h"
#include "third_party/openscreen/src/cast/streaming/remoting.pb.h"
RpcMessenger;
namespace cast_streaming::remoting {
namespace {
constexpr int kNumFramesInEachReadUntil = …;
constexpr base::TimeDelta kMinReadUntilCallFrequency = …;
constexpr base::TimeDelta kRequestTimeout = …;
}
RpcDemuxerStreamHandler::RpcDemuxerStreamHandler(
scoped_refptr<base::SequencedTaskRunner> task_runner,
Client* client,
HandleFactory handle_factory,
RpcProcessMessageCB process_message_cb)
: … { … }
RpcDemuxerStreamHandler::~RpcDemuxerStreamHandler() = default;
void RpcDemuxerStreamHandler::OnRpcAcquireDemuxer(
RpcMessenger::Handle audio_stream_handle,
RpcMessenger::Handle video_stream_handle) { … }
void RpcDemuxerStreamHandler::OnRpcEnableBitstreamConverterCallback(
RpcMessenger::Handle handle,
bool succeeded) { … }
void RpcDemuxerStreamHandler::OnRpcInitializeCallback(
RpcMessenger::Handle handle,
std::optional<media::AudioDecoderConfig> audio_config,
std::optional<media::VideoDecoderConfig> video_config) { … }
void RpcDemuxerStreamHandler::OnRpcReadUntilCallback(
RpcMessenger::Handle handle,
std::optional<media::AudioDecoderConfig> audio_config,
std::optional<media::VideoDecoderConfig> video_config,
uint32_t total_frames_received) { … }
void RpcDemuxerStreamHandler::OnRpcBitstreamConverterEnabled(
RpcMessenger::Handle handle,
bool success) { … }
base::WeakPtr<DemuxerStreamClient> RpcDemuxerStreamHandler::GetAudioClient() { … }
base::WeakPtr<DemuxerStreamClient> RpcDemuxerStreamHandler::GetVideoClient() { … }
RpcDemuxerStreamHandler::Client::~Client() = default;
RpcDemuxerStreamHandler::MessageProcessor::MessageProcessor(
scoped_refptr<base::SequencedTaskRunner> task_runner,
Client* client,
RpcProcessMessageCB process_message_cb,
RpcMessenger::Handle local_handle,
RpcMessenger::Handle remote_handle,
Type type)
: … { … }
RpcDemuxerStreamHandler::MessageProcessor::~MessageProcessor() = default;
bool RpcDemuxerStreamHandler::MessageProcessor::OnRpcInitializeCallback(
std::optional<media::AudioDecoderConfig> audio_config,
std::optional<media::VideoDecoderConfig> video_config) { … }
bool RpcDemuxerStreamHandler::MessageProcessor::OnRpcReadUntilCallback(
std::optional<media::AudioDecoderConfig> audio_config,
std::optional<media::VideoDecoderConfig> video_config,
uint32_t total_frames_received) { … }
void RpcDemuxerStreamHandler::MessageProcessor::OnBitstreamConverterEnabled(
bool success) { … }
base::WeakPtr<RpcDemuxerStreamHandler::MessageProcessor>
RpcDemuxerStreamHandler::MessageProcessor::GetWeakPtr() { … }
void RpcDemuxerStreamHandler::MessageProcessor::EnableBitstreamConverter(
BitstreamConverterEnabledCB cb) { … }
void RpcDemuxerStreamHandler::MessageProcessor::OnNoBuffersAvailable() { … }
void RpcDemuxerStreamHandler::MessageProcessor::OnError() { … }
void RpcDemuxerStreamHandler::MessageProcessor::OnBufferRequestTimeout() { … }
}