]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Open the codec context before checking if the codec can support fltp format.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 22 May 2022 21:18:39 +0000 (22:18 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 22 May 2022 21:18:39 +0000 (22:18 +0100)
shairport.c

index f375c8f67bc624a8c0a131cf5b2acd7d07c30800..099515e80f52f08404c7b5bd4e432b737f67bee7 100644 (file)
@@ -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