#include "media/mojo/services/mojo_renderer_service.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "media/base/cdm_context.h"
#include "media/base/media_url_demuxer.h"
#include "media/base/renderer.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/services/media_resource_shim.h"
#include "media/mojo/services/mojo_cdm_service_context.h"
namespace media {
constexpr auto kTimeUpdateInterval = …;
mojo::SelfOwnedReceiverRef<mojom::Renderer> MojoRendererService::Create(
MojoCdmServiceContext* mojo_cdm_service_context,
std::unique_ptr<media::Renderer> renderer,
mojo::PendingReceiver<mojom::Renderer> receiver) { … }
MojoRendererService::MojoRendererService(
MojoCdmServiceContext* mojo_cdm_service_context,
std::unique_ptr<media::Renderer> renderer)
: … { … }
MojoRendererService::~MojoRendererService() = default;
void MojoRendererService::Initialize(
mojo::PendingAssociatedRemote<mojom::RendererClient> client,
std::optional<std::vector<mojo::PendingRemote<mojom::DemuxerStream>>>
streams,
mojom::MediaUrlParamsPtr media_url_params,
InitializeCallback callback) { … }
void MojoRendererService::Flush(FlushCallback callback) { … }
void MojoRendererService::StartPlayingFrom(base::TimeDelta time_delta) { … }
void MojoRendererService::SetPlaybackRate(double playback_rate) { … }
void MojoRendererService::SetVolume(float volume) { … }
void MojoRendererService::SetCdm(
const std::optional<base::UnguessableToken>& cdm_id,
SetCdmCallback callback) { … }
void MojoRendererService::SetLatencyHint(
std::optional<base::TimeDelta> latency_hint) { … }
void MojoRendererService::OnError(PipelineStatus error) { … }
void MojoRendererService::OnFallback(PipelineStatus error) { … }
void MojoRendererService::OnEnded() { … }
void MojoRendererService::OnStatisticsUpdate(const PipelineStatistics& stats) { … }
void MojoRendererService::OnBufferingStateChange(
BufferingState state,
BufferingStateChangeReason reason) { … }
void MojoRendererService::OnWaiting(WaitingReason reason) { … }
void MojoRendererService::OnAudioConfigChange(
const AudioDecoderConfig& config) { … }
void MojoRendererService::OnVideoConfigChange(
const VideoDecoderConfig& config) { … }
void MojoRendererService::OnVideoNaturalSizeChange(const gfx::Size& size) { … }
void MojoRendererService::OnVideoOpacityChange(bool opaque) { … }
void MojoRendererService::OnVideoFrameRateChange(std::optional<int> fps) { … }
void MojoRendererService::OnAllStreamsReady(
base::OnceCallback<void(bool)> callback) { … }
void MojoRendererService::OnRendererInitializeDone(
base::OnceCallback<void(bool)> callback,
PipelineStatus status) { … }
void MojoRendererService::UpdateMediaTime(bool force) { … }
void MojoRendererService::CancelPeriodicMediaTimeUpdates() { … }
void MojoRendererService::SchedulePeriodicMediaTimeUpdates() { … }
void MojoRendererService::OnFlushCompleted(FlushCallback callback) { … }
void MojoRendererService::OnCdmAttached(base::OnceCallback<void(bool)> callback,
bool success) { … }
}