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

Unified Diff: media/base/media_log.cc

Issue 877273002: Add media log messages to the main log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use generic JSON serialization instead of handling each event type Created 5 years, 9 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
« no previous file with comments | « media/base/media_log.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_log.cc
diff --git a/media/base/media_log.cc b/media/base/media_log.cc
index a5188f4c38c60e9b4e9a7ddd2cd1526a77a90aae..73fc88ae7404e6f2b2b45cdd68f498189705e30a 100644
--- a/media/base/media_log.cc
+++ b/media/base/media_log.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/atomic_sequence_num.h"
+#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/values.h"
@@ -98,6 +99,22 @@ std::string MediaLog::PipelineStatusToString(PipelineStatus status) {
return NULL;
}
+std::string MediaLog::MediaEventToLogString(const MediaLogEvent& event) {
+ // Special case for PIPELINE_ERROR, since that's by far the most useful
+ // event for figuring out media pipeline failures, and just reporting
+ // pipeline status as numberic code is not very helpful/user-friendly.
wolenetz 2015/03/26 01:38:52 nit: s/numberic/numeric/
servolk 2015/03/26 17:06:47 Done.
+ int error_code = 0;
+ if (event.type == MediaLogEvent::PIPELINE_ERROR &&
+ event.params.GetInteger("pipeline_error", &error_code)) {
+ PipelineStatus status = static_cast<PipelineStatus>(error_code);
+ return EventTypeToString(event.type) + " " +
+ media::MediaLog::PipelineStatusToString(status);
+ }
+ std::string params_json;
+ base::JSONWriter::Write(&event.params, &params_json);
+ return EventTypeToString(event.type) + " " + params_json;
+}
+
LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {}
LogHelper::~LogHelper() {
« no previous file with comments | « media/base/media_log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698