From b1020bd77b476d026e71db8948bbec782defff98 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 17 Oct 2022 11:40:38 +0200 Subject: [PATCH] added --param audio-dec-format Forces decoded audio format. Mainly for testing but can be used also in case of problems (some format doesn't work correctly although device claims to support that). --- src/rtp/audio_decoders.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rtp/audio_decoders.cpp b/src/rtp/audio_decoders.cpp index ada4d9cbe..7b8f81e1b 100644 --- a/src/rtp/audio_decoders.cpp +++ b/src/rtp/audio_decoders.cpp @@ -458,6 +458,9 @@ static void *adec_compute_and_print_stats(void *arg) { return NULL; } + +ADD_TO_PARAM("audio-dec-format", "* audio-dec-format=|help\n" + " Forces specified format playback format.\n"); /** * Compares provided parameters with previous configuration and if it differs, reconfigure * the decoder, otherwise the reconfiguration is skipped. @@ -478,6 +481,12 @@ static bool audio_decoder_reconfigure(struct state_audio_decoder *decoder, struc int output_channels = decoder->channel_remapping ? decoder->channel_map.max_output + 1: input_channels; audio_desc device_desc = audio_desc{bps, sample_rate, output_channels, AC_PCM}; + if (const char *fmt = get_commandline_param("audio-dec-format")) { + if (int ret = parse_audio_format(fmt, &device_desc)) { + exit_uv(ret > 0 ? 0 : 1); + return false; + } + } size_t len = sizeof device_desc; if (!decoder->audio_playback_ctl_func(decoder->audio_playback_state, AUDIO_PLAYBACK_CTL_QUERY_FORMAT, &device_desc, &len)) { log_msg(LOG_LEVEL_ERROR, "Unable to query audio desc!\n");