From fbf75a78914b1444a95d42ee559bbd2a01cdefd8 Mon Sep 17 00:00:00 2001 From: Ilya Nikolaevskiy Date: Thu, 26 Sep 2019 17:39:26 +0200 Subject: [PATCH] Video: Log scalability configuration on encoder reconfigure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lately there were 2 separate bugs, where seeing this information in the log could help immediately figuring out the problem. Bug: none Change-Id: I3f2b2d5864106cdb231715e1702edee3b9b05caa Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154566 Reviewed-by: Erik Språng Commit-Queue: Ilya Nikolaevskiy Cr-Commit-Position: refs/heads/master@{#29338} --- video/video_stream_encoder.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index e4b244a52c..936d816db3 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -799,6 +799,40 @@ void VideoStreamEncoder::ReconfigureEncoder() { SvcRateAllocator::GetPaddingBitrate(codec).bps(); } + char log_stream_buf[4 * 1024]; + rtc::SimpleStringBuilder log_stream(log_stream_buf); + log_stream << "ReconfigureEncoder:\n"; + log_stream << "Simulcast streams:\n"; + for (size_t i = 0; i < codec.numberOfSimulcastStreams; ++i) { + log_stream << i << ": " << codec.simulcastStream[i].width << "x" + << codec.simulcastStream[i].height + << " fps: " << codec.simulcastStream[i].maxFramerate + << " min_bps: " << codec.simulcastStream[i].minBitrate + << " target_bps: " << codec.simulcastStream[i].targetBitrate + << " max_bps: " << codec.simulcastStream[i].maxBitrate + << " max_qp: " << codec.simulcastStream[i].qpMax + << " num_tl: " << codec.simulcastStream[i].numberOfTemporalLayers + << " active: " + << (codec.simulcastStream[i].active ? "true" : "false") << "\n"; + } + if (encoder_config_.codec_type == kVideoCodecVP9) { + size_t num_spatial_layers = codec.VP9()->numberOfSpatialLayers; + log_stream << "Spatial layers:\n"; + for (size_t i = 0; i < num_spatial_layers; ++i) { + log_stream << i << ": " << codec.spatialLayers[i].width << "x" + << codec.spatialLayers[i].height + << " fps: " << codec.spatialLayers[i].maxFramerate + << " min_bps: " << codec.spatialLayers[i].minBitrate + << " target_bps: " << codec.spatialLayers[i].targetBitrate + << " max_bps: " << codec.spatialLayers[i].maxBitrate + << " max_qp: " << codec.spatialLayers[i].qpMax + << " num_tl: " << codec.spatialLayers[i].numberOfTemporalLayers + << " active: " + << (codec.spatialLayers[i].active ? "true" : "false") << "\n"; + } + } + RTC_LOG(LS_INFO) << log_stream.str(); + codec.startBitrate = std::max(encoder_start_bitrate_bps_ / 1000, codec.minBitrate); codec.startBitrate = std::min(codec.startBitrate, codec.maxBitrate);