Created
June 2, 2015 14:39
-
-
Save nu774/05a082df7b4db39a23fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c | |
index 48cf637..8ad74e8 100644 | |
--- a/libavcodec/aacdec.c | |
+++ b/libavcodec/aacdec.c | |
@@ -457,6 +457,7 @@ static int output_configure(AACContext *ac, | |
AVCodecContext *avctx = ac->avctx; | |
int i, channels = 0, ret; | |
uint64_t layout = 0; | |
+ int type_counts[TYPE_END] = { 0 }; | |
if (ac->oc[1].layout_map != layout_map) { | |
memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0])); | |
@@ -470,12 +471,14 @@ static int output_configure(AACContext *ac, | |
for (i = 0; i < tags; i++) { | |
int type = layout_map[i][0]; | |
int id = layout_map[i][1]; | |
+ int iid = type_counts[type]++; | |
int position = layout_map[i][2]; | |
// Allocate or free elements depending on if they are in the | |
// current program configuration. | |
- ret = che_configure(ac, position, type, id, &channels); | |
+ ret = che_configure(ac, position, type, iid, &channels); | |
if (ret < 0) | |
return ret; | |
+ ac->tag_che_map[type][id] = ac->che[type][iid]; | |
} | |
if (ac->oc[1].m4ac.ps == 1 && channels == 2) { | |
if (layout == AV_CH_FRONT_CENTER) { | |
@@ -485,7 +488,6 @@ static int output_configure(AACContext *ac, | |
} | |
} | |
- memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); | |
if (layout) avctx->channel_layout = layout; | |
ac->oc[1].channel_layout = layout; | |
avctx->channels = ac->oc[1].channels = channels; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment