From 75bd2ad232a174f92265d9adc1e7cbefbb8da58a Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 1 Apr 2021 11:44:50 +0200 Subject: [PATCH] Set OPUS as a codec when audio protocol is RTSP/SDP Do not depend on video protocol which may be different. --- src/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 321aa61ca..9ffbc73e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1119,9 +1119,6 @@ int main(int argc, char *argv[]) // default values for different RXTX protocols if (strcasecmp(video_protocol, "rtsp") == 0 || strcasecmp(video_protocol, "sdp") == 0) { - if (audio_codec == nullptr) { - audio_codec = "OPUS:sample_rate=48000"; - } if (requested_compression == nullptr) { requested_compression = "none"; // will be set later by h264_sdp_video_rxtx::send_frame() } @@ -1132,7 +1129,12 @@ int main(int argc, char *argv[]) if (requested_compression == nullptr) { requested_compression = DEFAULT_VIDEO_COMPRESSION; } - if (audio_codec == nullptr) { + } + + if (audio_codec == nullptr) { + if (strcasecmp(audio_protocol, "rtsp") == 0 || strcasecmp(audio_protocol, "sdp") == 0) { + audio_codec = "OPUS:sample_rate=48000"; + } else { audio_codec = DEFAULT_AUDIO_CODEC; } }