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}
This commit is contained in:
Oskar Sundbom
2018-10-30 16:11:02 +01:00
committed by Commit Bot
parent 6bf20549bb
commit 56ef305b67
3 changed files with 42 additions and 16 deletions

View File

@ -65,6 +65,7 @@ rtc_static_library("audio") {
"../common_audio:common_audio_c",
"../logging:rtc_event_audio",
"../logging:rtc_event_log_api",
"../logging:rtc_stream_config",
"../modules/audio_coding",
"../modules/audio_coding:audio_format_conversion",
"../modules/audio_coding:audio_network_adaptor_config",

View File

@ -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 @@ std::unique_ptr<voe::ChannelSendProxy> CreateChannelAndProxy(
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 @@ void AudioSendStream::ConfigureStream(
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_;

View File

@ -30,7 +30,6 @@
#include "call/rtp_stream_receiver_controller.h"
#include "call/rtp_transport_controller_send.h"
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
@ -147,18 +146,6 @@ std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig(
return rtclog_config;
}
std::unique_ptr<rtclog::StreamConfig> CreateRtcLogStreamConfig(
const AudioSendStream::Config& config) {
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);
}
return rtclog_config;
}
} // namespace
namespace internal {
@ -579,9 +566,8 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
const webrtc::AudioSendStream::Config& config) {
TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
RTC_DCHECK_CALLED_SEQUENTIALLY(&configuration_sequence_checker_);
event_log_->Log(absl::make_unique<RtcEventAudioSendStreamConfig>(
CreateRtcLogStreamConfig(config)));
// Stream config is logged in AudioSendStream::ConfigureStream, as it may
// change during the stream's lifetime.
absl::optional<RtpState> suspended_rtp_state;
{
const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);