VideoEncoder: rtc::StringBuilder instead of rtc::SimpleStringBuilder.

Whenever encoding info change, this ToString() method is called for some
LS_INFO logging inside video_stream_encoder.cc. Apparently the char
buffer used for constructing this string is not large enough because I
can get WebRTC to crash in a demo page that gets and sets a lot of
parameters.

By changing to rtc::StringBuilder, we don't have to make assumptions
about how long the string can get at runtime.

Bug: None
Change-Id: I32695523282143a301c0e13e06082d55bd2796b3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375520
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43805}
This commit is contained in:
Henrik Boström 2025-01-27 13:49:51 +01:00 committed by WebRTC LUCI CQ
parent 39da6f3a75
commit 6b7099527a

View File

@ -120,9 +120,7 @@ VideoEncoder::EncoderInfo::EncoderInfo(const EncoderInfo&) = default;
VideoEncoder::EncoderInfo::~EncoderInfo() = default; VideoEncoder::EncoderInfo::~EncoderInfo() = default;
std::string VideoEncoder::EncoderInfo::ToString() const { std::string VideoEncoder::EncoderInfo::ToString() const {
char string_buf[2048]; rtc::StringBuilder oss;
rtc::SimpleStringBuilder oss(string_buf);
oss << "EncoderInfo { " oss << "EncoderInfo { "
"ScalingSettings { "; "ScalingSettings { ";
if (scaling_settings.thresholds) { if (scaling_settings.thresholds) {