From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sun, 22 May 2022 21:18:39 +0000 (+0100) Subject: Open the codec context before checking if the codec can support fltp format. X-Git-Tag: 4.1-rc1~24^2~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69cd95e9c146d5dcd11716d87a09bb656cbac5b0;p=thirdparty%2Fshairport-sync.git Open the codec context before checking if the codec can support fltp format. --- diff --git a/shairport.c b/shairport.c index f375c8f6..099515e8 100644 --- a/shairport.c +++ b/shairport.c @@ -148,7 +148,6 @@ void print_version(void) { #ifdef CONFIG_AIRPLAY_2 int has_fplt_capable_aac_decoder(void) { -/* // return 1 if the AAC decoder advertises ftlp decoding capability, which // is needed for decoding Buffered Audio streams int has_capability = 0; @@ -156,13 +155,15 @@ int has_fplt_capable_aac_decoder(void) { if (codec != NULL) { AVCodecContext *codec_context = avcodec_alloc_context3(codec); if (codec_context != NULL) { - if (codec_context->sample_fmt == AV_SAMPLE_FMT_FLTP) - has_capability = 1; + if (avcodec_open2(codec_context, codec, NULL) >= 0) { + if (codec_context->sample_fmt == AV_SAMPLE_FMT_FLTP) + has_capability = 1; + avcodec_close(codec_context); + } av_free(codec_context); } } -*/ - return 1; + return has_capability; } #endif