From: Gian-Carlo Pascutto <[email protected]>

Removes some cases where the profile might be not be set if it is
needed to decode some data to be sure of the profile.
---
 libavcodec/aacdec.c |   10 ++++++++++
 libavcodec/aacsbr.c |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index ae22e67..a4a859a 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2185,10 +2185,12 @@ static int decode_extension_payload(AACContext *ac, 
GetBitContext *gb, int cnt,
         } else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && 
ac->avctx->channels == 1) {
             ac->oc[1].m4ac.sbr = 1;
             ac->oc[1].m4ac.ps = 1;
+            ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
             output_configure(ac, ac->oc[1].layout_map, 
ac->oc[1].layout_map_tags,
                              ac->oc[1].status, 1);
         } else {
             ac->oc[1].m4ac.sbr = 1;
+            ac->avctx->profile = FF_PROFILE_AAC_HE;
         }
         res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, 
elem_type);
         break;
@@ -2772,6 +2774,14 @@ static int aac_decode_frame_int(AVCodecContext *avctx, 
void *data,
     if ((err = frame_configure_elements(avctx)) < 0)
         goto fail;
 
+    if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
+        ac->avctx->profile = FF_PROFILE_AAC_MAIN;
+    } else if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
+        ac->avctx->profile = FF_PROFILE_AAC_LTP;
+    } else {
+        ac->avctx->profile = FF_PROFILE_AAC_LOW;
+    }
+
     ac->tags_mapped = 0;
     // parse
     while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 650f7aa..d382247 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -919,6 +919,7 @@ static void read_sbr_extension(AACContext *ac, 
SpectralBandReplication *sbr,
         } else {
 #if 1
             *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, 
*num_bits_left);
+            ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
 #else
             avpriv_report_missing_feature(ac->avctx, "Parametric Stereo");
             skip_bits_long(gb, *num_bits_left); // bs_fill_bits
-- 
1.7.9

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to