| Index: content/renderer/media/render_media_log.cc
|
| diff --git a/content/renderer/media/render_media_log.cc b/content/renderer/media/render_media_log.cc
|
| index 1169f685b5a81ec6885ef39e92a8cb96195c0301..20a3486dd7c5bc7f07f061bc3b79e6de9db73eda 100644
|
| --- a/content/renderer/media/render_media_log.cc
|
| +++ b/content/renderer/media/render_media_log.cc
|
| @@ -28,16 +28,21 @@ void Log(media::MediaLogEvent* event) {
|
| if (event->type == media::MediaLogEvent::PIPELINE_ERROR ||
|
| event->type == media::MediaLogEvent::MEDIA_ERROR_LOG_ENTRY) {
|
| LOG(ERROR) << "MediaEvent: "
|
| - << media::MediaLog::MediaEventToLogString(*event);
|
| + << media::MediaLog::MediaEventToLogString(*event, true);
|
| } else if (event->type != media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED &&
|
| event->type != media::MediaLogEvent::PROPERTY_CHANGE &&
|
| event->type != media::MediaLogEvent::WATCH_TIME_UPDATE &&
|
| event->type != media::MediaLogEvent::NETWORK_ACTIVITY_SET) {
|
| - MEDIA_EVENT_LOG_UTILITY << "MediaEvent: "
|
| - << media::MediaLog::MediaEventToLogString(*event);
|
| + MEDIA_EVENT_LOG_UTILITY
|
| + << "MediaEvent: "
|
| + << media::MediaLog::MediaEventToLogString(*event, true);
|
| }
|
| }
|
|
|
| +// Limit the number of recent MEDIA_ERROR_LOG_ENTRY retained for use in
|
| +// GetErrorMessages(). Older entries are dropped to make room for newer ones.
|
| +const int kMaxErrorLogEntries = 20;
|
| +
|
| } // namespace
|
|
|
| namespace content {
|
| @@ -78,15 +83,17 @@ void RenderMediaLog::AddEvent(std::unique_ptr<media::MediaLogEvent> event) {
|
| last_duration_changed_event_.swap(event);
|
| break;
|
|
|
| - // Hold onto the most recent PIPELINE_ERROR and MEDIA_LOG_ERROR_ENTRY for
|
| - // use in GetLastErrorMessage().
|
| + // Hold onto the most recent PIPELINE_ERROR and (potentially multiple,
|
| + // capped number of) MEDIA_LOG_ERROR_ENTRY for use in GetErrorMessages().
|
| case media::MediaLogEvent::PIPELINE_ERROR:
|
| queued_media_events_.push_back(*event);
|
| last_pipeline_error_.swap(event);
|
| break;
|
| case media::MediaLogEvent::MEDIA_ERROR_LOG_ENTRY:
|
| queued_media_events_.push_back(*event);
|
| - last_media_error_log_entry_.swap(event);
|
| + recent_media_error_log_entries_.push_back(std::move(event));
|
| + if (recent_media_error_log_entries_.size() > kMaxErrorLogEntries)
|
| + recent_media_error_log_entries_.pop_front();
|
| break;
|
|
|
| // Just enqueue all other event types for throttled transmission.
|
| @@ -118,19 +125,22 @@ void RenderMediaLog::AddEvent(std::unique_ptr<media::MediaLogEvent> event) {
|
| FROM_HERE, base::Bind(&RenderMediaLog::SendQueuedMediaEvents, this));
|
| }
|
|
|
| -std::string RenderMediaLog::GetLastErrorMessage() {
|
| +std::map<std::string, std::vector<std::string>>
|
| +RenderMediaLog::GetErrorMessages() {
|
| base::AutoLock auto_lock(lock_);
|
|
|
| - // Return the conditional concatenation of the last pipeline error and the
|
| - // last media error log.
|
| - std::stringstream result;
|
| + std::map<std::string, std::vector<std::string>> result;
|
| if (last_pipeline_error_) {
|
| - result << MediaEventToLogString(*last_pipeline_error_)
|
| - << (last_media_error_log_entry_ ? ", " : "");
|
| + result[EventTypeToString(last_pipeline_error_->type)].push_back(
|
| + MediaEventToLogString(*last_pipeline_error_, false));
|
| + }
|
| +
|
| + for (const auto& entry : recent_media_error_log_entries_) {
|
| + result[EventTypeToString(entry->type)].push_back(
|
| + MediaEventToLogString(*entry, false));
|
| }
|
| - if (last_media_error_log_entry_)
|
| - result << MediaEventToLogString(*last_media_error_log_entry_);
|
| - return result.str();
|
| +
|
| + return result;
|
| }
|
|
|
| void RenderMediaLog::RecordRapporWithSecurityOrigin(const std::string& metric) {
|
|
|