From edc39dbe90b5145995c728498ddcb763ae732f32 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 8 Jan 2024 17:06:49 +0100 Subject: [PATCH] set default audio ch count to 1 for RTSP/SDP needed for SDP --- src/main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a759d732a..3752a245a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1128,12 +1128,15 @@ static int adjust_params(struct ug_options *opt) { } } + const bool tx_audio_std = strcasecmp(opt->audio.proto, "rtsp") == 0 || + strcasecmp(opt->audio.proto, "sdp") == 0; if (opt->audio.codec_cfg == nullptr) { - if (strcasecmp(opt->audio.proto, "rtsp") == 0 || strcasecmp(opt->audio.proto, "sdp") == 0) { - opt->audio.codec_cfg = "Opus:sample_rate=48000"; - } else { - opt->audio.codec_cfg = DEFAULT_AUDIO_CODEC; - } + opt->audio.codec_cfg = tx_audio_std ? "Opus:sample_rate=48000" + : DEFAULT_AUDIO_CODEC; + } + + if (tx_audio_std && audio_capture_channels == 0) { + audio_capture_channels = 1; // needed to be known early } if(opt->nat_traverse_config && strncmp(opt->nat_traverse_config, "holepunch", strlen("holepunch")) == 0){