#include "media/mojo/services/video_decode_perf_history.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/stringprintf.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/key_systems.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "media/capabilities/learning_helper.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
namespace media {
namespace {
const double kMaxSmoothDroppedFramesPercentParamDefault = …;
}
const char VideoDecodePerfHistory::kMaxSmoothDroppedFramesPercentParamName[] = …;
const char
VideoDecodePerfHistory::kEmeMaxSmoothDroppedFramesPercentParamName[] = …;
double VideoDecodePerfHistory::GetMaxSmoothDroppedFramesPercent(bool is_eme) { … }
base::FieldTrialParams VideoDecodePerfHistory::GetFieldTrialParams() { … }
VideoDecodePerfHistory::VideoDecodePerfHistory(
std::unique_ptr<VideoDecodeStatsDB> db,
learning::FeatureProviderFactoryCB feature_factory_cb)
: … { … }
VideoDecodePerfHistory::~VideoDecodePerfHistory() { … }
void VideoDecodePerfHistory::BindReceiver(
mojo::PendingReceiver<mojom::VideoDecodePerfHistory> receiver) { … }
void VideoDecodePerfHistory::InitDatabase() { … }
void VideoDecodePerfHistory::OnDatabaseInit(bool success) { … }
void VideoDecodePerfHistory::GetPerfInfo(mojom::PredictionFeaturesPtr features,
GetPerfInfoCallback got_info_cb) { … }
void VideoDecodePerfHistory::AssessStats(
const VideoDecodeStatsDB::VideoDescKey& key,
const VideoDecodeStatsDB::DecodeStatsEntry* stats,
bool* is_smooth,
bool* is_power_efficient) { … }
void VideoDecodePerfHistory::OnGotStatsForRequest(
const VideoDecodeStatsDB::VideoDescKey& video_key,
GetPerfInfoCallback got_info_cb,
bool database_success,
std::unique_ptr<VideoDecodeStatsDB::DecodeStatsEntry> stats) { … }
VideoDecodePerfHistory::SaveCallback VideoDecodePerfHistory::GetSaveCallback() { … }
void VideoDecodePerfHistory::SavePerfRecord(ukm::SourceId source_id,
learning::FeatureValue origin,
bool is_top_frame,
mojom::PredictionFeatures features,
mojom::PredictionTargets targets,
uint64_t player_id,
base::OnceClosure save_done_cb) { … }
void VideoDecodePerfHistory::OnGotStatsForSave(
ukm::SourceId source_id,
bool is_top_frame,
uint64_t player_id,
const VideoDecodeStatsDB::VideoDescKey& video_key,
const VideoDecodeStatsDB::DecodeStatsEntry& new_stats,
base::OnceClosure save_done_cb,
bool success,
std::unique_ptr<VideoDecodeStatsDB::DecodeStatsEntry> past_stats) { … }
void VideoDecodePerfHistory::OnSaveDone(base::OnceClosure save_done_cb,
bool success) { … }
void VideoDecodePerfHistory::ReportUkmMetrics(
ukm::SourceId source_id,
bool is_top_frame,
uint64_t player_id,
const VideoDecodeStatsDB::VideoDescKey& video_key,
const VideoDecodeStatsDB::DecodeStatsEntry& new_stats,
VideoDecodeStatsDB::DecodeStatsEntry* past_stats) { … }
void VideoDecodePerfHistory::ClearHistory(base::OnceClosure clear_done_cb) { … }
void VideoDecodePerfHistory::OnClearedHistory(base::OnceClosure clear_done_cb) { … }
void VideoDecodePerfHistory::GetVideoDecodeStatsDB(GetCB get_db_cb) { … }
}