Index: media/base/media_log.cc |
diff --git a/media/base/media_log.cc b/media/base/media_log.cc |
index e354ea03e8c05115636a2a9d0d2e9c759ee63ac9..1b2a16b92eca1d2d50170ed537f152b757bfd0e4 100644 |
--- a/media/base/media_log.cc |
+++ b/media/base/media_log.cc |
@@ -8,6 +8,7 @@ |
#include "base/atomic_sequence_num.h" |
#include "base/json/json_writer.h" |
+#include "base/strings/string_util.h" |
#include "base/values.h" |
namespace media { |
@@ -218,11 +219,33 @@ std::string MediaLog::MediaEventToLogString(const MediaLogEvent& event) { |
PipelineStatus status = static_cast<PipelineStatus>(error_code); |
return EventTypeToString(event.type) + " " + PipelineStatusToString(status); |
} |
+ |
std::string params_json; |
base::JSONWriter::Write(event.params, ¶ms_json); |
return EventTypeToString(event.type) + " " + params_json; |
} |
+std::string MediaLog::MediaEventToMessageString(const MediaLogEvent& event) { |
+ switch (event.type) { |
+ case MediaLogEvent::PIPELINE_ERROR: { |
+ int error_code = 0; |
+ event.params.GetInteger("pipeline_error", &error_code); |
+ DCHECK_NE(error_code, 0); |
+ return PipelineStatusToString(static_cast<PipelineStatus>(error_code)); |
+ } |
+ case MediaLogEvent::MEDIA_ERROR_LOG_ENTRY: { |
+ std::string result = ""; |
+ if (event.params.GetString(MediaLogLevelToString(MEDIALOG_ERROR), |
+ &result)) |
+ base::ReplaceChars(result, "\n", " ", &result); |
+ return result; |
+ } |
+ default: |
+ NOTREACHED(); |
+ return ""; |
+ } |
+} |
+ |
std::string MediaLog::BufferingStateToString(BufferingState state) { |
switch (state) { |
case BUFFERING_HAVE_NOTHING: |
@@ -240,7 +263,7 @@ MediaLog::~MediaLog() {} |
void MediaLog::AddEvent(std::unique_ptr<MediaLogEvent> event) {} |
-std::string MediaLog::GetLastErrorMessage() { |
+std::string MediaLog::GetErrorMessage() { |
return ""; |
} |