#include "media/remoting/stream_provider.h"
#include <vector>
#include "base/containers/circular_deque.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer.h"
#include "media/base/video_transformation.h"
#include "media/cast/openscreen/remoting_proto_enum_utils.h"
#include "media/cast/openscreen/remoting_proto_utils.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "media/remoting/receiver_controller.h"
#include "third_party/openscreen/src/cast/streaming/rpc_messenger.h"
RpcMessenger;
namespace media {
namespace remoting {
namespace {
constexpr int kNumFramesInEachReadUntil = …;
}
void StreamProvider::MediaStream::CreateOnMainThread(
RpcMessenger* rpc_messenger,
Type type,
int32_t handle,
const scoped_refptr<base::SequencedTaskRunner>& media_task_runner,
base::OnceCallback<void(MediaStream::UniquePtr)> callback) { … }
void StreamProvider::MediaStream::DestructionHelper(MediaStream* stream) { … }
StreamProvider::MediaStream::MediaStream(
RpcMessenger* rpc_messenger,
Type type,
int remote_handle,
const scoped_refptr<base::SequencedTaskRunner>& media_task_runner)
: … { … }
StreamProvider::MediaStream::~MediaStream() { … }
void StreamProvider::MediaStream::Destroy() { … }
void StreamProvider::MediaStream::SendRpcMessageOnMainThread(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::MediaStream::Initialize(
base::OnceClosure init_done_callback) { … }
void StreamProvider::MediaStream::InitializeDataPipe(
mojo::ScopedDataPipeConsumerHandle data_pipe) { … }
void StreamProvider::MediaStream::ReceiveFrame(uint32_t count,
mojom::DecoderBufferPtr buffer) { … }
void StreamProvider::MediaStream::FlushUntil(uint32_t count) { … }
void StreamProvider::MediaStream::OnReceivedRpc(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::MediaStream::OnInitializeCallback(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::MediaStream::CompleteInitialize() { … }
void StreamProvider::MediaStream::OnReadUntilCallback(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::MediaStream::UpdateAudioConfig(
const openscreen::cast::AudioDecoderConfig& audio_message) { … }
void StreamProvider::MediaStream::UpdateVideoConfig(
const openscreen::cast::VideoDecoderConfig& video_message) { … }
void StreamProvider::MediaStream::SendReadUntil() { … }
void StreamProvider::MediaStream::Read(uint32_t , ReadCB read_cb) { … }
void StreamProvider::MediaStream::CompleteRead(DemuxerStream::Status status) { … }
AudioDecoderConfig StreamProvider::MediaStream::audio_decoder_config() { … }
VideoDecoderConfig StreamProvider::MediaStream::video_decoder_config() { … }
DemuxerStream::Type StreamProvider::MediaStream::type() const { … }
StreamLiveness StreamProvider::MediaStream::liveness() const { … }
bool StreamProvider::MediaStream::SupportsConfigChanges() { … }
void StreamProvider::MediaStream::AppendBuffer(
uint32_t count,
scoped_refptr<DecoderBuffer> buffer) { … }
void StreamProvider::MediaStream::OnError(const std::string& error) { … }
StreamProvider::StreamProvider(
ReceiverController* receiver_controller,
const scoped_refptr<base::SequencedTaskRunner>& media_task_runner)
: … { … }
StreamProvider::~StreamProvider() { … }
std::string StreamProvider::GetDisplayName() const { … }
DemuxerType StreamProvider::GetDemuxerType() const { … }
void StreamProvider::Initialize(DemuxerHost* host,
PipelineStatusCallback status_cb) { … }
void StreamProvider::AbortPendingReads() { … }
void StreamProvider::StartWaitingForSeek(base::TimeDelta seek_time) { … }
void StreamProvider::CancelPendingSeek(base::TimeDelta seek_time) { … }
void StreamProvider::Seek(base::TimeDelta time,
PipelineStatusCallback seek_cb) { … }
bool StreamProvider::IsSeekable() const { … }
void StreamProvider::Stop() { … }
base::TimeDelta StreamProvider::GetStartTime() const { … }
base::Time StreamProvider::GetTimelineOffset() const { … }
int64_t StreamProvider::GetMemoryUsage() const { … }
std::optional<container_names::MediaContainerName>
StreamProvider::GetContainerForMetrics() const { … }
void StreamProvider::OnEnabledAudioTracksChanged(
const std::vector<MediaTrack::Id>& track_ids,
base::TimeDelta curr_time,
TrackChangeCB change_completed_cb) { … }
void StreamProvider::OnSelectedVideoTrackChanged(
const std::vector<MediaTrack::Id>& track_ids,
base::TimeDelta curr_time,
TrackChangeCB change_completed_cb) { … }
void StreamProvider::Destroy() { … }
void StreamProvider::OnReceivedRpc(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::OnAcquireDemuxer(
std::unique_ptr<openscreen::cast::RpcMessage> message) { … }
void StreamProvider::OnAudioStreamCreated(MediaStream::UniquePtr stream) { … }
void StreamProvider::OnVideoStreamCreated(MediaStream::UniquePtr stream) { … }
void StreamProvider::InitializeDataPipe() { … }
void StreamProvider::OnAudioStreamInitialized() { … }
void StreamProvider::OnVideoStreamInitialized() { … }
void StreamProvider::CompleteInitialize() { … }
std::vector<DemuxerStream*> StreamProvider::GetAllStreams() { … }
}
}
namespace std {
void default_delete<media::remoting::StreamProvider>::operator()(
media::remoting::StreamProvider* ptr) const { … }
}