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, ¶ms_json); |
+ return EventTypeToString(event.type) + " " + params_json; |
+} |
+ |
LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} |
LogHelper::~LogHelper() { |