Skip to content

Commit 3bb78af

Browse files
uknunknownFlole998
authored andcommitted
fix bug in AAC channel layout configuration tab
fix bug in AAC channel layout configuration tab There are few issues: 1. first entry in combo should be AUTO (with value 0) - in original code was set to 1 (and overwritten later) 2. l->nb_channel is not the best way to cycle though layouts available. At the end I think is accessing some region outside of the struct (because I see is lopped also after 7.1). The way I knew how to fix was to add the filter (l->nb_channels < 32). Maybe changing the while to for will be a better option. 3. av_channel_layout() is returning the length of the string ... we should use l_buf only when retuned value > 0 ... when is < 0 l_buf was not updated.
1 parent 267aef1 commit 3bb78af

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/transcoding/codec/profile_audio_class.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self)
105105
else {
106106
#if LIBAVCODEC_VERSION_MAJOR > 59
107107
l = channel_layouts;
108-
ADD_ENTRY(list, map, s64, l->u.mask, str, AUTO_STR);
109-
while (l->nb_channels) {
108+
ADD_ENTRY(list, map, s64, 0, str, AUTO_STR);
109+
while (l->nb_channels < 32) {
110110
if (!(map = htsmsg_create_map())) {
111111
htsmsg_destroy(list);
112112
list = NULL;
113113
break;
114114
}
115115
l_buf[0] = '\0';
116-
av_channel_layout_describe(l, l_buf, sizeof(l_buf));
117-
ADD_ENTRY(list, map, s64, l->u.mask, str, l_buf);
116+
if(av_channel_layout_describe(l, l_buf, sizeof(l_buf)) > 0)
117+
ADD_ENTRY(list, map, s64, l->u.mask, str, l_buf);
118118
l++;
119119
}
120120
#else

0 commit comments

Comments
 (0)