Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: media/cdm/ppapi/cdm_adapter.cc

Issue 568623003: CdmAdapter: Report size of the file read by CDM via FileIO. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/ppapi/cdm_adapter.cc
diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc
index 9f2d27eebc7fd5daee120253c2a632d7d17eb881..53d9872d8d85eea4549909ed66cd393ba822f298 100644
--- a/media/cdm/ppapi/cdm_adapter.cc
+++ b/media/cdm/ppapi/cdm_adapter.cc
@@ -19,6 +19,12 @@
namespace {
+// Constants for UMA reporting of file size (in KB) via HistogramCustomCounts().
+// Note that the histogram is log-scaled (rather than linear).
+const uint32_t kSizeKBMin = 1;
ddorwin 2014/09/12 02:26:28 What about 0? There can be empty files. Or maybe w
xhwang 2014/09/12 04:30:12 https://code.google.com/p/chromium/codesearch#chro
+const uint32_t kSizeKBMax = 512 * 1024; // 512MB
+const uint32_t kSizeKBBuckets = 100;
+
#if !defined(NDEBUG)
#define DLOG_TO_CONSOLE(message) LogToConsole(message);
#else
@@ -267,7 +273,9 @@ CdmAdapter::CdmAdapter(PP_Instance instance, pp::Module* module)
deferred_initialize_audio_decoder_(false),
deferred_audio_decoder_config_id_(0),
deferred_initialize_video_decoder_(false),
- deferred_video_decoder_config_id_(0) {
+ deferred_video_decoder_config_id_(0),
+ last_read_file_size_kb_(0),
+ file_size_uma_reported_(false) {
callback_factory_.Initialize(this);
}
@@ -759,6 +767,17 @@ void CdmAdapter::OnRejectPromise(uint32_t promise_id,
uint32_t system_code,
const char* error_message,
uint32_t error_message_length) {
+ // UMA to investigate http://crbug.com/410630
+ // TODO(xhwang): Remove after bug is fixed.
+ if (system_code == 0x27) {
+ pp::UMAPrivate uma_interface(this);
+ uma_interface.HistogramCustomCounts("Media.EME.CdmFileIO.FileSizeKBOnError",
+ last_read_file_size_kb_,
+ kSizeKBMin,
+ kSizeKBMax,
+ kSizeKBBuckets);
+ }
+
RejectPromise(promise_id,
error,
system_code,
@@ -1082,6 +1101,25 @@ bool CdmAdapter::IsValidVideoFrame(const LinkedVideoFrame& video_frame) {
return true;
}
+void CdmAdapter::OnFileRead(int32_t file_size_bytes) {
+ PP_DCHECK(IsMainThread());
+ PP_DCHECK(file_size_bytes >= 0);
+
+ last_read_file_size_kb_ = file_size_bytes / 1000;
ddorwin 2014/09/12 02:26:28 Why 1000 instead of 1024? Your max above would be
xhwang 2014/09/12 04:30:12 lol, good catch! Fixed.
+
+ if (file_size_uma_reported_)
+ return;
+
+ pp::UMAPrivate uma_interface(this);
+ uma_interface.HistogramCustomCounts(
+ "Media.EME.CdmFileIO.FileSizeKBOnFirstRead",
+ last_read_file_size_kb_,
+ kSizeKBMin,
+ kSizeKBMax,
+ kSizeKBBuckets);
+ file_size_uma_reported_ = true;
+}
+
#if !defined(NDEBUG)
void CdmAdapter::LogToConsole(const pp::Var& value) {
PP_DCHECK(IsMainThread());
@@ -1189,7 +1227,10 @@ void CdmAdapter::OnDeferredInitializationDone(cdm::StreamType stream_type,
// The CDM owns the returned object and must call FileIO::Close() to release it.
cdm::FileIO* CdmAdapter::CreateFileIO(cdm::FileIOClient* client) {
- return new CdmFileIOImpl(client, pp_instance());
+ return new CdmFileIOImpl(
+ client,
+ pp_instance(),
+ callback_factory_.NewCallback(&CdmAdapter::OnFileRead));
}
#if defined(OS_CHROMEOS)

Powered by Google App Engine
This is Rietveld 408576698