#include "media/capabilities/webrtc_video_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/strings/string_util.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/webrtc_video_stats.pb.h"
namespace media {
ProtoVideoStatsEntry;
std::unique_ptr<WebrtcVideoStatsDBImpl> WebrtcVideoStatsDBImpl::Create(
base::FilePath db_dir,
leveldb_proto::ProtoDatabaseProvider* db_provider) { … }
WebrtcVideoStatsDBImpl::WebrtcVideoStatsDBImpl(
std::unique_ptr<leveldb_proto::ProtoDatabase<WebrtcVideoStatsEntryProto>>
db)
: … { … }
WebrtcVideoStatsDBImpl::~WebrtcVideoStatsDBImpl() { … }
void WebrtcVideoStatsDBImpl::Initialize(InitializeCB init_cb) { … }
void WebrtcVideoStatsDBImpl::OnInit(PendingOperations::Id op_id,
InitializeCB init_cb,
leveldb_proto::Enums::InitStatus status) { … }
bool WebrtcVideoStatsDBImpl::IsInitialized() { … }
void WebrtcVideoStatsDBImpl::AppendVideoStats(
const VideoDescKey& key,
const VideoStats& video_stats,
AppendVideoStatsCB append_done_cb) { … }
void WebrtcVideoStatsDBImpl::GetVideoStats(const VideoDescKey& key,
GetVideoStatsCB get_stats_cb) { … }
void WebrtcVideoStatsDBImpl::GetVideoStatsCollection(
const VideoDescKey& key,
GetVideoStatsCollectionCB get_stats_cb) { … }
bool WebrtcVideoStatsDBImpl::AreStatsValid(
const WebrtcVideoStatsEntryProto* const stats_proto) { … }
void WebrtcVideoStatsDBImpl::WriteUpdatedEntry(
PendingOperations::Id op_id,
const VideoDescKey& key,
const VideoStats& new_video_stats,
AppendVideoStatsCB append_done_cb,
bool read_success,
std::unique_ptr<WebrtcVideoStatsEntryProto> existing_entry_proto) { … }
void WebrtcVideoStatsDBImpl::OnEntryUpdated(PendingOperations::Id op_id,
AppendVideoStatsCB append_done_cb,
bool success) { … }
void WebrtcVideoStatsDBImpl::OnGotVideoStats(
PendingOperations::Id op_id,
GetVideoStatsCB get_stats_cb,
bool success,
std::unique_ptr<WebrtcVideoStatsEntryProto> stats_proto) { … }
void WebrtcVideoStatsDBImpl::OnGotVideoStatsCollection(
PendingOperations::Id op_id,
GetVideoStatsCollectionCB get_stats_cb,
bool success,
std::unique_ptr<std::map<std::string, WebrtcVideoStatsEntryProto>>
stats_proto_collection) { … }
void WebrtcVideoStatsDBImpl::ClearStats(base::OnceClosure clear_done_cb) { … }
void WebrtcVideoStatsDBImpl::OnStatsCleared(PendingOperations::Id op_id,
base::OnceClosure clear_done_cb,
bool success) { … }
}