#include "media/capabilities/video_decode_stats_db_impl.h"
#include <memory>
#include <string>
#include <tuple>
#include "base/debug/alias.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequence_checker.h"
#include "base/task/thread_pool.h"
#include "base/time/default_clock.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "media/base/media_switches.h"
#include "media/capabilities/video_decode_stats.pb.h"
namespace media {
ProtoDecodeStatsEntry;
namespace {
const int kMaxFramesPerBufferDefault = …;
const int kMaxDaysToKeepStatsDefault = …;
const bool kEnableUnweightedEntriesDefault = …;
}
const char VideoDecodeStatsDBImpl::kMaxFramesPerBufferParamName[] = …;
const char VideoDecodeStatsDBImpl::kMaxDaysToKeepStatsParamName[] = …;
const char VideoDecodeStatsDBImpl::kEnableUnweightedEntriesParamName[] = …;
int VideoDecodeStatsDBImpl::GetMaxFramesPerBuffer() { … }
int VideoDecodeStatsDBImpl::GetMaxDaysToKeepStats() { … }
bool VideoDecodeStatsDBImpl::GetEnableUnweightedEntries() { … }
base::FieldTrialParams VideoDecodeStatsDBImpl::GetFieldTrialParams() { … }
std::unique_ptr<VideoDecodeStatsDBImpl> VideoDecodeStatsDBImpl::Create(
base::FilePath db_dir,
leveldb_proto::ProtoDatabaseProvider* db_provider) { … }
constexpr char VideoDecodeStatsDBImpl::kDefaultWriteTime[];
VideoDecodeStatsDBImpl::VideoDecodeStatsDBImpl(
std::unique_ptr<leveldb_proto::ProtoDatabase<DecodeStatsProto>> db)
: … { … }
VideoDecodeStatsDBImpl::~VideoDecodeStatsDBImpl() { … }
void VideoDecodeStatsDBImpl::Initialize(InitializeCB init_cb) { … }
void VideoDecodeStatsDBImpl::OnInit(PendingOperations::Id op_id,
InitializeCB init_cb,
leveldb_proto::Enums::InitStatus status) { … }
bool VideoDecodeStatsDBImpl::IsInitialized() { … }
void VideoDecodeStatsDBImpl::AppendDecodeStats(
const VideoDescKey& key,
const DecodeStatsEntry& entry,
AppendDecodeStatsCB append_done_cb) { … }
void VideoDecodeStatsDBImpl::GetDecodeStats(const VideoDescKey& key,
GetDecodeStatsCB get_stats_cb) { … }
bool VideoDecodeStatsDBImpl::AreStatsUsable(
const DecodeStatsProto* const stats_proto) { … }
void VideoDecodeStatsDBImpl::WriteUpdatedEntry(
PendingOperations::Id op_id,
const VideoDescKey& key,
const DecodeStatsEntry& new_entry,
AppendDecodeStatsCB append_done_cb,
bool read_success,
std::unique_ptr<DecodeStatsProto> stats_proto) { … }
void VideoDecodeStatsDBImpl::OnEntryUpdated(PendingOperations::Id op_id,
AppendDecodeStatsCB append_done_cb,
bool success) { … }
void VideoDecodeStatsDBImpl::OnGotDecodeStats(
PendingOperations::Id op_id,
GetDecodeStatsCB get_stats_cb,
bool success,
std::unique_ptr<DecodeStatsProto> stats_proto) { … }
void VideoDecodeStatsDBImpl::ClearStats(base::OnceClosure clear_done_cb) { … }
void VideoDecodeStatsDBImpl::OnStatsCleared(PendingOperations::Id op_id,
base::OnceClosure clear_done_cb,
bool success) { … }
}