Skip to content

Commit

Permalink
[media] Add memory info to HTMLMediaElement error message (youtube#3669)
Browse files Browse the repository at this point in the history
Add the result of SbSystemGetTotalCPUMemory() and
SbSystemGetUsedCPUMemory() to media element error message, also remove
all ',' from the error message to save log space.

b/348438829
  • Loading branch information
xiaomings authored Jun 24, 2024
1 parent 8a3efab commit 25efb1e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cobalt/media/base/playback_statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "base/strings/stringprintf.h"
#include "starboard/atomic.h"
#include "starboard/common/string.h"
#include "starboard/system.h"

namespace cobalt {
namespace media {
Expand Down Expand Up @@ -228,13 +229,15 @@ void PlaybackStatistics::OnError(PipelineStatus status,
std::string PlaybackStatistics::GetStatistics(
const VideoDecoderConfig& current_video_config) const {
return starboard::FormatString(
"current_codec: %s, drm: %s, width: %d, height: %d"
", active_players (max): %d (%d), av1: ~%" PRId64 ", h264: ~%" PRId64
", hevc: ~%" PRId64 ", vp8: ~%" PRId64 ", vp9: ~%" PRId64
", min_width: %d, min_height: %d, max_width: %d, max_height: %d"
", last_working_codec: %s, seek_time: %s"
", first_audio_time: ~%" PRId64 ", first_video_time: ~%" PRId64
", last_audio_time: ~%" PRId64 ", last_video_time: ~%" PRId64,
"total_mem %" PRId64 ", used_mem %" PRId64
", current_codec %s, drm %s, width %d, height %d"
", active_players (max) %d (%d), av1 ~%" PRId64 ", h264 ~%" PRId64
", hevc ~%" PRId64 ", vp8 ~%" PRId64 ", vp9 ~%" PRId64
", min_width %d, min_height %d, max_width %d, max_height %d"
", last_working_codec %s, seek_time %s"
", first_audio_time ~%" PRId64 ", first_video_time ~%" PRId64
", last_audio_time ~%" PRId64 ", last_video_time ~%" PRId64,
SbSystemGetTotalCPUMemory(), SbSystemGetUsedCPUMemory(),
GetCodecName(current_video_config.codec()).c_str(),
(current_video_config.is_encrypted() ? "Y" : "N"), video_width_.value(),
video_height_.value(), SbAtomicNoBarrier_Load(&s_active_instances),
Expand Down

0 comments on commit 25efb1e

Please sign in to comment.