]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/flac_parser: Use native endianness when possible
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 6 Oct 2019 05:01:13 +0000 (07:01 +0200)
committerPaul B Mahol <onemda@gmail.com>
Mon, 7 Oct 2019 20:27:18 +0000 (22:27 +0200)
FLAC sync codes contain a byte equal to 0xFF and so the function that
searches for sync codes first searched for this byte. It did this by
checking four bytes at once; these bytes have been read via AV_RB32, but
the test works just as well with native endianness.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/flac_parser.c

index 2721286464d83de25c085f3760b0d31da1b65c0b..5d0705ce631f7563ec5a305aa99a6594be2495e3 100644 (file)
@@ -221,7 +221,7 @@ static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, int buf_size
     }
 
     for (; i < buf_size - 1; i += 4) {
-        x = AV_RB32(buf + i);
+        x = AV_RN32(buf + i);
         if (((x & ~(x + 0x01010101)) & 0x80808080)) {
             for (j = 0; j < 4; j++) {
                 if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)