]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/aac_ac3_parser: account for data already in the parsing buffer
authorHendrik Leppkes <h.leppkes@gmail.com>
Thu, 5 Apr 2018 15:09:35 +0000 (17:09 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Sun, 15 Apr 2018 08:18:26 +0000 (10:18 +0200)
If a frame starts very close to a packet boundary, the start code may
already have been added to the parsing buffer, indicated by a small
negative value of "i", while the header is still being tracked in the
"state" variable.

Reduce the remaining size accordingly, otherwise trying to find the next
frame could skip over the frame header and lump two frames together as
one.

libavcodec/aac_ac3_parser.c

index 019074b0dd43a88f20dc6767640d2ac05f3ed16a..54e459844f141c8c176ac64a2be4b360a4c4f56b 100644 (file)
@@ -60,6 +60,9 @@ get_next:
                     s->remaining_size += i;
                     goto get_next;
                 }
+                else if (i < 0) {
+                    s->remaining_size += i;
+                }
             }
         }
     }