#include "components/cast_streaming/browser/cast_streaming_session.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "components/cast_streaming/browser/cast_message_port_converter.h"
#include "components/cast_streaming/browser/common/decoder_buffer_factory.h"
#include "components/cast_streaming/browser/control/remoting/remoting_decoder_buffer_factory.h"
#include "components/cast_streaming/browser/frame/mirroring_decoder_buffer_factory.h"
#include "components/cast_streaming/browser/frame/stream_consumer.h"
#include "components/cast_streaming/browser/receiver_config_conversions.h"
#include "components/cast_streaming/common/public/features.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_switches.h"
#include "media/base/timestamp_constants.h"
#include "media/cast/openscreen/config_conversions.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace cast_streaming {
namespace {
constexpr base::TimeDelta kNoDataTimeout = …;
bool CreateDataPipeForStreamType(media::DemuxerStream::Type type,
mojo::ScopedDataPipeProducerHandle* producer,
mojo::ScopedDataPipeConsumerHandle* consumer) { … }
constexpr base::TimeDelta kInitTimeout = …;
StreamingInitializationInfo CreateMirroringInitializationInfo(
const openscreen::cast::ReceiverSession* session,
openscreen::cast::ReceiverSession::ConfiguredReceivers receivers) { … }
}
CastStreamingSession::ReceiverSessionClient::ReceiverSessionClient(
CastStreamingSession::Client* client,
std::optional<RendererControllerConfig> renderer_controls,
ReceiverConfig av_constraints,
ReceiverSession::MessagePortProvider message_port_provider,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: … { … }
void CastStreamingSession::ReceiverSessionClient::GetAudioBuffer(
base::OnceClosure no_frames_available_cb) { … }
void CastStreamingSession::ReceiverSessionClient::GetVideoBuffer(
base::OnceClosure no_frames_available_cb) { … }
void CastStreamingSession::ReceiverSessionClient::PreloadAudioBuffer(
media::mojom::DecoderBufferPtr buffer) { … }
void CastStreamingSession::ReceiverSessionClient::PreloadVideoBuffer(
media::mojom::DecoderBufferPtr buffer) { … }
CastStreamingSession::ReceiverSessionClient::~ReceiverSessionClient() { … }
void CastStreamingSession::ReceiverSessionClient::OnInitializationTimeout() { … }
std::optional<mojo::ScopedDataPipeConsumerHandle>
CastStreamingSession::ReceiverSessionClient::InitializeAudioConsumer(
const StreamingInitializationInfo& initialization_info) { … }
std::optional<mojo::ScopedDataPipeConsumerHandle>
CastStreamingSession::ReceiverSessionClient::InitializeVideoConsumer(
const StreamingInitializationInfo& initialization_info) { … }
void CastStreamingSession::ReceiverSessionClient::StartStreamingSession(
StreamingInitializationInfo initialization_info) { … }
void CastStreamingSession::ReceiverSessionClient::OnNegotiated(
const openscreen::cast::ReceiverSession* session,
openscreen::cast::ReceiverSession::ConfiguredReceivers receivers) { … }
void CastStreamingSession::ReceiverSessionClient::OnRemotingNegotiated(
const openscreen::cast::ReceiverSession* session,
openscreen::cast::ReceiverSession::RemotingNegotiation negotiation) { … }
void CastStreamingSession::ReceiverSessionClient::OnReceiversDestroying(
const openscreen::cast::ReceiverSession* session,
ReceiversDestroyingReason reason) { … }
void CastStreamingSession::ReceiverSessionClient::OnFlushComplete() { … }
void CastStreamingSession::ReceiverSessionClient::OnFlushUntil(
uint32_t audio_count,
uint32_t video_count) { … }
void CastStreamingSession::ReceiverSessionClient::OnError(
const openscreen::cast::ReceiverSession* session,
const openscreen::Error& error) { … }
void CastStreamingSession::ReceiverSessionClient::OnDataTimeout() { … }
void CastStreamingSession::ReceiverSessionClient::OnCastChannelClosed() { … }
base::WeakPtr<CastStreamingSession::ReceiverSessionClient>
CastStreamingSession::ReceiverSessionClient::GetWeakPtr() { … }
CastStreamingSession::Client::~Client() = default;
CastStreamingSession::CastStreamingSession() = default;
CastStreamingSession::~CastStreamingSession() = default;
void CastStreamingSession::Start(
Client* client,
std::optional<RendererControllerConfig> renderer_controls,
ReceiverConfig av_constraints,
ReceiverSession::MessagePortProvider message_port_provider,
scoped_refptr<base::SequencedTaskRunner> task_runner) { … }
void CastStreamingSession::Stop() { … }
AudioDemuxerStreamDataProvider::RequestBufferCB
CastStreamingSession::GetAudioBufferRequester() { … }
VideoDemuxerStreamDataProvider::RequestBufferCB
CastStreamingSession::GetVideoBufferRequester() { … }
CastStreamingSession::PreloadBufferCB
CastStreamingSession::GetAudioBufferPreloader() { … }
CastStreamingSession::PreloadBufferCB
CastStreamingSession::GetVideoBufferPreloader() { … }
}