Move event logging of config into AudioSendStream.
It was previously logged in Call, but streams are not always created
with the full configuration, which caused header extensions to be
missing from the log.
Bug: webrtc:9885
Change-Id: I86c0424004c4629ebab0f6b155b83fb90e15b131
Reviewed-on: https://webrtc-review.googlesource.com/c/108601
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25483}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index f778745..f11dace 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -28,6 +28,9 @@
#include "call/rtp_transport_controller_send_interface.h"
#include "common_audio/vad/include/vad.h"
#include "common_types.h" // NOLINT(build/include)
+#include "logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h"
+#include "logging/rtc_event_log/rtc_event_log.h"
+#include "logging/rtc_event_log/rtc_stream_config.h"
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/checks.h"
@@ -69,6 +72,39 @@
worker_queue, module_process_thread, media_transport, rtcp_rtt_stats,
event_log, frame_encryptor, crypto_options, extmap_allow_mixed));
}
+
+void UpdateEventLogStreamConfig(RtcEventLog* event_log,
+ const AudioSendStream::Config& config,
+ const AudioSendStream::Config* old_config) {
+ using SendCodecSpec = AudioSendStream::Config::SendCodecSpec;
+ // Only update if any of the things we log have changed.
+ auto payload_types_equal = [](const absl::optional<SendCodecSpec>& a,
+ const absl::optional<SendCodecSpec>& b) {
+ if (a.has_value() && b.has_value()) {
+ return a->format.name == b->format.name &&
+ a->payload_type == b->payload_type;
+ }
+ return !a.has_value() && !b.has_value();
+ };
+
+ if (old_config && config.rtp.ssrc == old_config->rtp.ssrc &&
+ config.rtp.extensions == old_config->rtp.extensions &&
+ payload_types_equal(config.send_codec_spec,
+ old_config->send_codec_spec)) {
+ return;
+ }
+
+ auto rtclog_config = absl::make_unique<rtclog::StreamConfig>();
+ rtclog_config->local_ssrc = config.rtp.ssrc;
+ rtclog_config->rtp_extensions = config.rtp.extensions;
+ if (config.send_codec_spec) {
+ rtclog_config->codecs.emplace_back(config.send_codec_spec->format.name,
+ config.send_codec_spec->payload_type, 0);
+ }
+ event_log->Log(absl::make_unique<RtcEventAudioSendStreamConfig>(
+ std::move(rtclog_config)));
+}
+
} // namespace
// Helper class to track the actively sending lifetime of this stream.
@@ -221,6 +257,9 @@
bool first_time) {
RTC_LOG(LS_INFO) << "AudioSendStream::ConfigureStream: "
<< new_config.ToString();
+ UpdateEventLogStreamConfig(stream->event_log_, new_config,
+ first_time ? nullptr : &stream->config_);
+
const auto& channel_proxy = stream->channel_proxy_;
const auto& old_config = stream->config_;