[FFmpeg-devel] [PATCH 2/3 v3] avcodec/aacdec_template: add more checks to make sure only 22.2 gets to 22.2

Jan Ekström jeebjp at gmail.com
Tue Aug 25 00:36:29 EEST 2020


On Mon, Aug 24, 2020 at 11:04 PM Paul B Mahol <onemda at gmail.com> wrote:
>
> On 8/22/20, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> > Am Sa., 22. Aug. 2020 um 23:15 Uhr schrieb Jan Ekström <jeebjp at gmail.com>:
> >>
> >> On Sat, Aug 22, 2020 at 11:42 PM Carl Eugen Hoyos <ceffmpeg at gmail.com>
> >> wrote:
> >> >
> >> > Am Sa., 22. Aug. 2020 um 22:40 Uhr schrieb Jan Ekström
> >> > <jeebjp at gmail.com>:
> >> > >
> >> > > Validates the set channel layout as well as verifies that the received
> >> > > layout to the function matches the reference layout, so that it
> >> > > matches
> >> > > the implemented re-ordering logic.
> >> > >
> >> > > Fixes #8845
> >> >
> >> > Did you also see tickets #8859 and #8860?
> >> >
> >>
> >> No, but I just tested them and each and every version of the patch set
> >> on the mailing list starting from the 18th did indeed make them not
> >> happen, incl. the current one.
> >
> > Thank you for confirming this!
>
> Patches should be fine.
>
> There is only one way to find if that patch breaks good/normal files.
>

Thanks for taking a look. Applied patches 1 and 2 as
de1d6aa0a3d4358e9975e0d6fe5c655fd38694fe and
d6f293353c94c7ce200f6e0975ae3de49787f91f.

With 1/2 while doing final verifications I noticed I had accidentally
left one case of setting layout to UINT64_MAX, so there is a small
diff to the posted version:
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 10ceeca261..5906ed20b3 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -410,15 +410,14 @@ static uint64_t sniff_channel_order(uint8_t
(*layout_map)[3], int tags)
     while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
         e2c_vec[i] = (struct elem_to_channel) {
             .av_position  = UINT64_MAX,
             .syn_ele      = TYPE_LFE,
             .elem_id      = layout_map[i][1],
             .aac_position = AAC_CHANNEL_LFE
         };
-        layout |= e2c_vec[i].av_position;
         i++;
     }

     // The previous checks would end up at 8 at this point for 22.2
     if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
         const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12];
         for (int j = 0; j < tags; j++) {

UINT64_MAX is not supposed to be applied to the layout bit mask, so
this was just a mistake by me while making the original patch.

As for real life cases, the only files I've seen so far beyond 10.2
have been 22.2 broadcast samples, and those still successfully get
parsed as they just have channel_config = 13.

Jan


More information about the ffmpeg-devel mailing list