#include "media/mojo/services/media_metrics_provider.h"
#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/base/key_systems.h"
#include "media/base/renderer.h"
#include "media/base/video_codecs.h"
#include "media/learning/mojo/mojo_learning_task_controller_service.h"
#include "media/mojo/services/video_decode_stats_recorder.h"
#include "media/mojo/services/watch_time_recorder.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#if !BUILDFLAG(IS_ANDROID)
#include "media/filters/decrypting_video_decoder.h"
#endif
#if BUILDFLAG(ENABLE_CAST_RECEIVER) && \
(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_ANDROID))
#include "media/mojo/services/playback_events_recorder.h"
#endif
namespace media {
constexpr char kInvalidInitialize[] = …;
static uint64_t g_player_id = …;
MediaMetricsProvider::PipelineInfo::PipelineInfo(bool is_incognito)
: … { … }
MediaMetricsProvider::PipelineInfo::~PipelineInfo() = default;
MediaMetricsProvider::MediaMetricsProvider(
BrowsingMode is_incognito,
FrameStatus is_top_frame,
ukm::SourceId source_id,
learning::FeatureValue origin,
VideoDecodePerfHistory::SaveCallback save_cb,
GetLearningSessionCallback learning_session_cb,
IsShuttingDownCallback is_shutting_down_cb)
: … { … }
MediaMetricsProvider::~MediaMetricsProvider() { … }
std::string MediaMetricsProvider::GetUMANameForAVStream(
const PipelineInfo& player_info) { … }
void MediaMetricsProvider::ReportPipelineUMA() { … }
void MediaMetricsProvider::Create(
BrowsingMode is_incognito,
FrameStatus is_top_frame,
ukm::SourceId source_id,
learning::FeatureValue origin,
VideoDecodePerfHistory::SaveCallback save_cb,
GetLearningSessionCallback learning_session_cb,
IsShuttingDownCallback is_shutting_down_cb,
mojo::PendingReceiver<mojom::MediaMetricsProvider> receiver) { … }
void MediaMetricsProvider::SetHasPlayed() { … }
void MediaMetricsProvider::SetHasAudio(AudioCodec audio_codec) { … }
void MediaMetricsProvider::SetHasVideo(VideoCodec video_codec) { … }
void MediaMetricsProvider::SetHaveEnough() { … }
void MediaMetricsProvider::SetVideoPipelineInfo(const VideoPipelineInfo& info) { … }
void MediaMetricsProvider::SetAudioPipelineInfo(const AudioPipelineInfo& info) { … }
void MediaMetricsProvider::Initialize(
bool is_mse,
mojom::MediaURLScheme url_scheme,
mojom::MediaStreamType media_stream_type) { … }
void MediaMetricsProvider::OnStarted(const PipelineStatus& status) { … }
void MediaMetricsProvider::OnError(const PipelineStatus& status) { … }
void MediaMetricsProvider::OnFallback(const PipelineStatus& status) { … }
void MediaMetricsProvider::SetIsEME() { … }
void MediaMetricsProvider::SetTimeToMetadata(base::TimeDelta elapsed) { … }
void MediaMetricsProvider::SetTimeToFirstFrame(base::TimeDelta elapsed) { … }
void MediaMetricsProvider::SetTimeToPlayReady(base::TimeDelta elapsed) { … }
void MediaMetricsProvider::SetContainerName(
container_names::MediaContainerName container_name) { … }
void MediaMetricsProvider::SetRendererType(RendererType renderer_type) { … }
void MediaMetricsProvider::SetKeySystem(const std::string& key_system) { … }
void MediaMetricsProvider::SetHasWaitingForKey() { … }
void MediaMetricsProvider::SetIsHardwareSecure() { … }
void MediaMetricsProvider::AcquireWatchTimeRecorder(
mojom::PlaybackPropertiesPtr properties,
mojo::PendingReceiver<mojom::WatchTimeRecorder> receiver) { … }
void MediaMetricsProvider::AcquireVideoDecodeStatsRecorder(
mojo::PendingReceiver<mojom::VideoDecodeStatsRecorder> receiver) { … }
void MediaMetricsProvider::AcquirePlaybackEventsRecorder(
mojo::PendingReceiver<mojom::PlaybackEventsRecorder> receiver) { … }
void MediaMetricsProvider::AcquireLearningTaskController(
const std::string& taskName,
mojo::PendingReceiver<learning::mojom::LearningTaskController> receiver) { … }
bool MediaMetricsProvider::IsInitialized() const { … }
}