[FFmpeg-devel,2/3] avcodec/mpeg4video_parser: Fix incorrect spliting of MPEG-4 studio frames

Submitted by Michael Niedermayer on April 29, 2018, 9:56 p.m.

Details

Message ID 20180429215616.17303-2-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer April 29, 2018, 9:56 p.m.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mpeg4video_parser.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kieran Kunhya April 29, 2018, 11:22 p.m.
On Sun, 29 Apr 2018 at 22:57 Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mpeg4video_parser.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/mpeg4video_parser.c
> b/libavcodec/mpeg4video_parser.c
> index b7d6da1f75..453d373e6e 100644
> --- a/libavcodec/mpeg4video_parser.c
> +++ b/libavcodec/mpeg4video_parser.c
> @@ -61,6 +61,8 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const
> uint8_t *buf, int buf_size)
>          for (; i < buf_size; i++) {
>              state = (state << 8) | buf[i];
>              if ((state & 0xFFFFFF00) == 0x100) {
> +                if (state == 0x1B7 || state == 0x1B8)
> +                    continue;
>                  pc->frame_start_found = 0;
>                  pc->state             = -1;
>                  return i - 3;
> --
>

Add a comment explaining what you are doing here please.
Kieran
Michael Niedermayer April 30, 2018, 4:18 p.m.
On Sun, Apr 29, 2018 at 11:22:42PM +0000, Kieran Kunhya wrote:
> On Sun, 29 Apr 2018 at 22:57 Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/mpeg4video_parser.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavcodec/mpeg4video_parser.c
> > b/libavcodec/mpeg4video_parser.c
> > index b7d6da1f75..453d373e6e 100644
> > --- a/libavcodec/mpeg4video_parser.c
> > +++ b/libavcodec/mpeg4video_parser.c
> > @@ -61,6 +61,8 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const
> > uint8_t *buf, int buf_size)
> >          for (; i < buf_size; i++) {
> >              state = (state << 8) | buf[i];
> >              if ((state & 0xFFFFFF00) == 0x100) {
> > +                if (state == 0x1B7 || state == 0x1B8)
> > +                    continue;
> >                  pc->frame_start_found = 0;
> >                  pc->state             = -1;
> >                  return i - 3;
> > --
> >
> 
> Add a comment explaining what you are doing here please.

will use named constants to make this more clear

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index b7d6da1f75..453d373e6e 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -61,6 +61,8 @@  int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
         for (; i < buf_size; i++) {
             state = (state << 8) | buf[i];
             if ((state & 0xFFFFFF00) == 0x100) {
+                if (state == 0x1B7 || state == 0x1B8)
+                    continue;
                 pc->frame_start_found = 0;
                 pc->state             = -1;
                 return i - 3;