diff --git a/src/audio/audio.h b/src/audio/audio.h index c949d4fed..04090a8cd 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -49,6 +49,9 @@ #ifndef _AUDIO_H_ #define _AUDIO_H_ +#define DEFAULT_AUDIO_FEC "none" +#define DEFAULT_AUDIO_SCALE "mixauto" + #define AUDIO_PROTOCOLS "JACK, rtsp, sdp or ultragrid_rtp" // available audio protocols #define PORT_AUDIO 5006 @@ -69,9 +72,9 @@ struct audio_options { const char *send_cfg = "none"; const char *proto = "ultragrid_rtp"; const char *proto_cfg = ""; - const char *fec_cfg = "none"; + const char *fec_cfg = DEFAULT_AUDIO_FEC; char *channel_map = nullptr; - const char *scale = "none"; + const char *scale = DEFAULT_AUDIO_SCALE; bool echo_cancellation = false; const char *codec_cfg = "PCM"; const char *filter_cfg = ""; diff --git a/src/main.cpp b/src/main.cpp index 83552cc26..c90b0abbd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,7 +121,6 @@ #define MOD_NAME "[main] " #define PORT_BASE 5004 -#define DEFAULT_AUDIO_FEC "none" static constexpr const char *DEFAULT_VIDEO_COMPRESSION = "none"; static constexpr const char *DEFAULT_AUDIO_CODEC = "PCM"; @@ -495,6 +494,10 @@ static void copy_sv_to_c_buf(char (&dest)[N], std::string_view sv){ struct ug_options { ug_options() { vidcap_params_set_device(vidcap_params_head, "none"); + // will be adjusted later + audio.recv_port = -1; + audio.send_port = -1; + audio.codec_cfg = "PCM"; } ~ug_options() { while (vidcap_params_head != nullptr) { @@ -503,21 +506,7 @@ struct ug_options { vidcap_params_head = next; } } - struct audio_options audio = { - .host = nullptr, - .recv_port = -1, - .send_port = -1, - .recv_cfg = "none", - .send_cfg = "none", - .proto = "ultragrid_rtp", - .proto_cfg = "", - .fec_cfg = DEFAULT_AUDIO_FEC, - .channel_map = nullptr, - .scale = "mixauto", - .echo_cancellation = false, - .codec_cfg = nullptr, - .filter_cfg = "" - }; + struct audio_options audio; std::string audio_filter_cfg; // NULL terminated array of capture devices struct vidcap_params *vidcap_params_head = vidcap_params_allocate();