From d7e2aff9942ef54ea67244179aab87fdf3fe8028 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 22 Oct 2022 11:10:24 +0100 Subject: [PATCH] fdkaacenc: fix output caps in case of implicit signaling and HE-AAC Need to put the actual profile in the output caps otherwise any capsfilter after the encoder that was used to force the output profile will fail, such as fdkaacenc ! audio/mpeg,stream-format=adts,profile=he-aac-v1 ! .. because we put profile=lc in there to match the profile signaled in the ADTS header. This is expressed through the base-profile=lc in the GStreamer caps though, the profile needs to carry the 'real' profile. Part-of: --- subprojects/gst-plugins-bad/ext/fdkaac/gstfdkaacenc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/fdkaac/gstfdkaacenc.c b/subprojects/gst-plugins-bad/ext/fdkaac/gstfdkaacenc.c index 54e46ba..fff0d76 100644 --- a/subprojects/gst-plugins-bad/ext/fdkaac/gstfdkaacenc.c +++ b/subprojects/gst-plugins-bad/ext/fdkaac/gstfdkaacenc.c @@ -220,12 +220,13 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info) GstCaps *allowed_caps; GstCaps *src_caps; AACENC_ERROR err; - gint transmux = 0, aot = AOT_AAC_LC; + gint transmux = 0; gint mpegversion = 4; + gint aot = AOT_AAC_LC; + const gchar *profile_str = "lc"; CHANNEL_MODE channel_mode; AACENC_InfoStruct enc_info = { 0 }; gint bitrate, signaling_mode; - const gchar *ext_profile; if (self->enc && !self->is_drained) { /* drain */ @@ -259,15 +260,19 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info) if (strcmp (str, "lc") == 0) { GST_DEBUG_OBJECT (self, "using AAC-LC profile for output"); aot = AOT_AAC_LC; + profile_str = "lc"; } else if (strcmp (str, "he-aac-v1") == 0) { GST_DEBUG_OBJECT (self, "using SBR (HE-AACv1) profile for output"); aot = AOT_SBR; + profile_str = "he-aac-v1"; } else if (strcmp (str, "he-aac-v2") == 0) { GST_DEBUG_OBJECT (self, "using PS (HE-AACv2) profile for output"); aot = AOT_PS; + profile_str = "he-aac-v2"; } else if (strcmp (str, "ld") == 0) { GST_DEBUG_OBJECT (self, "using AAC-LD profile for output"); aot = AOT_ER_AAC_LD; + profile_str = "ld"; } } @@ -466,12 +471,8 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info) enc_info.confSize); /* The above only parses the "base" profile, which is always going to be LC. - * Let's retrieve the extension AOT and set it as our profile in the caps. */ - ext_profile = gst_codec_utils_aac_get_extension_profile (enc_info.confBuf, - enc_info.confSize); - - if (ext_profile) - gst_caps_set_simple (src_caps, "profile", G_TYPE_STRING, ext_profile, NULL); + * Set actual profile. */ + gst_caps_set_simple (src_caps, "profile", G_TYPE_STRING, profile_str, NULL); /* An AAC-LC-only decoder will not decode a stream that uses explicit * hierarchical signaling */ -- 2.7.4