diff mbox

[FFmpeg-devel,v2] lavc/hevc: Don't parse NAL unit for a dummy buffer

Message ID 20180330024232.2006-1-haihao.xiang@intel.com
State Accepted
Commit 4c14a25281bb496092e2a6f930e4f1f9e900514f
Headers show

Commit Message

Xiang, Haihao March 30, 2018, 2:42 a.m. UTC
hevc parser mistakenly reports the following message if a dummy buffer
is padded for EOF

   [hevc @ 0x559b63848610] missing picture in access unit

v2: use the preferred code style and rebase the patch

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavcodec/hevc_parser.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Xiang, Haihao April 8, 2018, 4:53 a.m. UTC | #1
Hi Steven,

Are there more comments on this patch? 

Thanks
Haihao


> hevc parser mistakenly reports the following message if a dummy buffer

> is padded for EOF

> 

>    [hevc @ 0x559b63848610] missing picture in access unit

> 

> v2: use the preferred code style and rebase the patch

> 

> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>

> ---

>  libavcodec/hevc_parser.c | 7 ++++++-

>  1 file changed, 6 insertions(+), 1 deletion(-)

> 

> diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c

> index a468682ed3..01418b276d 100644

> --- a/libavcodec/hevc_parser.c

> +++ b/libavcodec/hevc_parser.c

> @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext *s,

> AVCodecContext *avctx,

>      int next;

>      HEVCParserContext *ctx = s->priv_data;

>      ParseContext *pc = &ctx->pc;

> +    int is_dummy_buf = !buf_size;

> +    const uint8_t *dummy_buf = buf;

>  

>      if (avctx->extradata && !ctx->parsed_extradata) {

>          ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,

> &ctx->ps, &ctx->sei,

> @@ -313,7 +315,10 @@ static int hevc_parse(AVCodecParserContext *s,

> AVCodecContext *avctx,

>          }

>      }

>  

> -    parse_nal_units(s, buf, buf_size, avctx);

> +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));

> +

> +    if (!is_dummy_buf)

> +        parse_nal_units(s, buf, buf_size, avctx);

>  

>      *poutbuf      = buf;

>      *poutbuf_size = buf_size;
Liu Steven April 8, 2018, 6:41 a.m. UTC | #2
> On 8 Apr 2018, at 12:53, Xiang, Haihao <haihao.xiang@intel.com> wrote:
> 
> 
> 
> Hi Steven,
> 
> Are there more comments on this patch? 
> 
> Thanks
> Haihao
> 
> 
>> hevc parser mistakenly reports the following message if a dummy buffer
>> is padded for EOF
>> 
>>   [hevc @ 0x559b63848610] missing picture in access unit
>> 
>> v2: use the preferred code style and rebase the patch
>> 
>> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
>> ---
>> libavcodec/hevc_parser.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
>> index a468682ed3..01418b276d 100644
>> --- a/libavcodec/hevc_parser.c
>> +++ b/libavcodec/hevc_parser.c
>> @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext *s,
>> AVCodecContext *avctx,
>>     int next;
>>     HEVCParserContext *ctx = s->priv_data;
>>     ParseContext *pc = &ctx->pc;
>> +    int is_dummy_buf = !buf_size;
>> +    const uint8_t *dummy_buf = buf;
>> 
>>     if (avctx->extradata && !ctx->parsed_extradata) {
>>         ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,
>> &ctx->ps, &ctx->sei,
>> @@ -313,7 +315,10 @@ static int hevc_parse(AVCodecParserContext *s,
>> AVCodecContext *avctx,
>>         }
>>     }
>> 
>> -    parse_nal_units(s, buf, buf_size, avctx);
>> +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));
>> +
>> +    if (!is_dummy_buf)
>> +        parse_nal_units(s, buf, buf_size, avctx);
>> 
>>     *poutbuf      = buf;
>>     *poutbuf_size = buf_size;

LGTM

Thanks
Steven
Xiang, Haihao April 13, 2018, 1:03 a.m. UTC | #3
Thank Steven for reviewing the patch, could anyone help to push the patch?

Best Regards
Haihao

> > On 8 Apr 2018, at 12:53, Xiang, Haihao <haihao.xiang@intel.com> wrote:

> > 

> > 

> > 

> > Hi Steven,

> > 

> > Are there more comments on this patch? 

> > 

> > Thanks

> > Haihao

> > 

> > 

> > > hevc parser mistakenly reports the following message if a dummy buffer

> > > is padded for EOF

> > > 

> > >   [hevc @ 0x559b63848610] missing picture in access unit

> > > 

> > > v2: use the preferred code style and rebase the patch

> > > 

> > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>

> > > ---

> > > libavcodec/hevc_parser.c | 7 ++++++-

> > > 1 file changed, 6 insertions(+), 1 deletion(-)

> > > 

> > > diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c

> > > index a468682ed3..01418b276d 100644

> > > --- a/libavcodec/hevc_parser.c

> > > +++ b/libavcodec/hevc_parser.c

> > > @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext *s,

> > > AVCodecContext *avctx,

> > >     int next;

> > >     HEVCParserContext *ctx = s->priv_data;

> > >     ParseContext *pc = &ctx->pc;

> > > +    int is_dummy_buf = !buf_size;

> > > +    const uint8_t *dummy_buf = buf;

> > > 

> > >     if (avctx->extradata && !ctx->parsed_extradata) {

> > >         ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,

> > > &ctx->ps, &ctx->sei,

> > > @@ -313,7 +315,10 @@ static int hevc_parse(AVCodecParserContext *s,

> > > AVCodecContext *avctx,

> > >         }

> > >     }

> > > 

> > > -    parse_nal_units(s, buf, buf_size, avctx);

> > > +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));

> > > +

> > > +    if (!is_dummy_buf)

> > > +        parse_nal_units(s, buf, buf_size, avctx);

> > > 

> > >     *poutbuf      = buf;

> > >     *poutbuf_size = buf_size;

> 

> LGTM

> 

> Thanks

> Steven

> 

> 

> 

> 

>
mypopy@gmail.com Sept. 28, 2018, 1:51 a.m. UTC | #4
On Fri, Apr 13, 2018 at 9:04 AM Xiang, Haihao <haihao.xiang@intel.com> wrote:
>
>
> Thank Steven for reviewing the patch, could anyone help to push the patch?
>
> Best Regards
> Haihao
>
> > > On 8 Apr 2018, at 12:53, Xiang, Haihao <haihao.xiang@intel.com> wrote:
> > >
> > >
> > >
> > > Hi Steven,
> > >
> > > Are there more comments on this patch?
> > >
> > > Thanks
> > > Haihao
> > >
> > >
> > > > hevc parser mistakenly reports the following message if a dummy buffer
> > > > is padded for EOF
> > > >
> > > >   [hevc @ 0x559b63848610] missing picture in access unit
> > > >
> > > > v2: use the preferred code style and rebase the patch
> > > >
> > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > ---
> > > > libavcodec/hevc_parser.c | 7 ++++++-
> > > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
> > > > index a468682ed3..01418b276d 100644
> > > > --- a/libavcodec/hevc_parser.c
> > > > +++ b/libavcodec/hevc_parser.c
> > > > @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext *s,
> > > > AVCodecContext *avctx,
> > > >     int next;
> > > >     HEVCParserContext *ctx = s->priv_data;
> > > >     ParseContext *pc = &ctx->pc;
> > > > +    int is_dummy_buf = !buf_size;
> > > > +    const uint8_t *dummy_buf = buf;
> > > >
> > > >     if (avctx->extradata && !ctx->parsed_extradata) {
> > > >         ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,
> > > > &ctx->ps, &ctx->sei,
> > > > @@ -313,7 +315,10 @@ static int hevc_parse(AVCodecParserContext *s,
> > > > AVCodecContext *avctx,
> > > >         }
> > > >     }
> > > >
> > > > -    parse_nal_units(s, buf, buf_size, avctx);
> > > > +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));
> > > > +
> > > > +    if (!is_dummy_buf)
> > > > +        parse_nal_units(s, buf, buf_size, avctx);
> > > >
> > > >     *poutbuf      = buf;
> > > >     *poutbuf_size = buf_size;
> >
> > LGTM
> >
> > Thanks
> > Steven
> >
> >


I've encountered this annoying error message, can we push the patch? Thanks.

BTW: The dummy_buf is not part of the original HEVC clip, it's come
from  av_parser_parse2() if buf_size == 0.

Thanks.
Zhong Li Sept. 29, 2018, 3:11 a.m. UTC | #5
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of mypopy@gmail.com

> Sent: Friday, September 28, 2018 9:51 AM

> To: FFmpeg development discussions and patches

> <ffmpeg-devel@ffmpeg.org>

> Cc: lq@chinaffmpeg.org; sw@jkqxz.net

> Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/hevc: Don't parse NAL unit for a

> dummy buffer

> 

> On Fri, Apr 13, 2018 at 9:04 AM Xiang, Haihao <haihao.xiang@intel.com>

> wrote:

> >

> >

> > Thank Steven for reviewing the patch, could anyone help to push the

> patch?

> >

> > Best Regards

> > Haihao

> >

> > > > On 8 Apr 2018, at 12:53, Xiang, Haihao <haihao.xiang@intel.com>

> wrote:

> > > >

> > > >

> > > >

> > > > Hi Steven,

> > > >

> > > > Are there more comments on this patch?

> > > >

> > > > Thanks

> > > > Haihao

> > > >

> > > >

> > > > > hevc parser mistakenly reports the following message if a dummy

> > > > > buffer is padded for EOF

> > > > >

> > > > >   [hevc @ 0x559b63848610] missing picture in access unit

> > > > >

> > > > > v2: use the preferred code style and rebase the patch

> > > > >

> > > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>

> > > > > ---

> > > > > libavcodec/hevc_parser.c | 7 ++++++-

> > > > > 1 file changed, 6 insertions(+), 1 deletion(-)

> > > > >

> > > > > diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c

> > > > > index a468682ed3..01418b276d 100644

> > > > > --- a/libavcodec/hevc_parser.c

> > > > > +++ b/libavcodec/hevc_parser.c

> > > > > @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext

> > > > > *s, AVCodecContext *avctx,

> > > > >     int next;

> > > > >     HEVCParserContext *ctx = s->priv_data;

> > > > >     ParseContext *pc = &ctx->pc;

> > > > > +    int is_dummy_buf = !buf_size;

> > > > > +    const uint8_t *dummy_buf = buf;

> > > > >

> > > > >     if (avctx->extradata && !ctx->parsed_extradata) {

> > > > >         ff_hevc_decode_extradata(avctx->extradata,

> > > > > avctx->extradata_size, &ctx->ps, &ctx->sei, @@ -313,7 +315,10 @@

> > > > > static int hevc_parse(AVCodecParserContext *s, AVCodecContext

> > > > > *avctx,

> > > > >         }

> > > > >     }

> > > > >

> > > > > -    parse_nal_units(s, buf, buf_size, avctx);

> > > > > +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));

> > > > > +

> > > > > +    if (!is_dummy_buf)

> > > > > +        parse_nal_units(s, buf, buf_size, avctx);

> > > > >

> > > > >     *poutbuf      = buf;

> > > > >     *poutbuf_size = buf_size;

> > >

> > > LGTM

> > >

> > > Thanks

> > > Steven

> > >

> > >

> 

> 

> I've encountered this annoying error message, can we push the patch?

> Thanks.

> 

> BTW: The dummy_buf is not part of the original HEVC clip, it's come from

> av_parser_parse2() if buf_size == 0.

> 

> Thanks.


Patch LGTM.
Michael Niedermayer Sept. 30, 2018, 12:29 a.m. UTC | #6
On Sat, Sep 29, 2018 at 03:11:40AM +0000, Li, Zhong wrote:
> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf
> > Of mypopy@gmail.com
> > Sent: Friday, September 28, 2018 9:51 AM
> > To: FFmpeg development discussions and patches
> > <ffmpeg-devel@ffmpeg.org>
> > Cc: lq@chinaffmpeg.org; sw@jkqxz.net
> > Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/hevc: Don't parse NAL unit for a
> > dummy buffer
> > 
> > On Fri, Apr 13, 2018 at 9:04 AM Xiang, Haihao <haihao.xiang@intel.com>
> > wrote:
> > >
> > >
> > > Thank Steven for reviewing the patch, could anyone help to push the
> > patch?
> > >
> > > Best Regards
> > > Haihao
> > >
> > > > > On 8 Apr 2018, at 12:53, Xiang, Haihao <haihao.xiang@intel.com>
> > wrote:
> > > > >
> > > > >
> > > > >
> > > > > Hi Steven,
> > > > >
> > > > > Are there more comments on this patch?
> > > > >
> > > > > Thanks
> > > > > Haihao
> > > > >
> > > > >
> > > > > > hevc parser mistakenly reports the following message if a dummy
> > > > > > buffer is padded for EOF
> > > > > >
> > > > > >   [hevc @ 0x559b63848610] missing picture in access unit
> > > > > >
> > > > > > v2: use the preferred code style and rebase the patch
> > > > > >
> > > > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > > > ---
> > > > > > libavcodec/hevc_parser.c | 7 ++++++-
> > > > > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
> > > > > > index a468682ed3..01418b276d 100644
> > > > > > --- a/libavcodec/hevc_parser.c
> > > > > > +++ b/libavcodec/hevc_parser.c
> > > > > > @@ -294,6 +294,8 @@ static int hevc_parse(AVCodecParserContext
> > > > > > *s, AVCodecContext *avctx,
> > > > > >     int next;
> > > > > >     HEVCParserContext *ctx = s->priv_data;
> > > > > >     ParseContext *pc = &ctx->pc;
> > > > > > +    int is_dummy_buf = !buf_size;
> > > > > > +    const uint8_t *dummy_buf = buf;
> > > > > >
> > > > > >     if (avctx->extradata && !ctx->parsed_extradata) {
> > > > > >         ff_hevc_decode_extradata(avctx->extradata,
> > > > > > avctx->extradata_size, &ctx->ps, &ctx->sei, @@ -313,7 +315,10 @@
> > > > > > static int hevc_parse(AVCodecParserContext *s, AVCodecContext
> > > > > > *avctx,
> > > > > >         }
> > > > > >     }
> > > > > >
> > > > > > -    parse_nal_units(s, buf, buf_size, avctx);
> > > > > > +    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));
> > > > > > +
> > > > > > +    if (!is_dummy_buf)
> > > > > > +        parse_nal_units(s, buf, buf_size, avctx);
> > > > > >
> > > > > >     *poutbuf      = buf;
> > > > > >     *poutbuf_size = buf_size;
> > > >
> > > > LGTM
> > > >
> > > > Thanks
> > > > Steven
> > > >
> > > >
> > 
> > 
> > I've encountered this annoying error message, can we push the patch?
> > Thanks.
> > 
> > BTW: The dummy_buf is not part of the original HEVC clip, it's come from
> > av_parser_parse2() if buf_size == 0.
> > 
> > Thanks.
> 
> Patch LGTM.

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index a468682ed3..01418b276d 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -294,6 +294,8 @@  static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
     int next;
     HEVCParserContext *ctx = s->priv_data;
     ParseContext *pc = &ctx->pc;
+    int is_dummy_buf = !buf_size;
+    const uint8_t *dummy_buf = buf;
 
     if (avctx->extradata && !ctx->parsed_extradata) {
         ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, &ctx->ps, &ctx->sei,
@@ -313,7 +315,10 @@  static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
         }
     }
 
-    parse_nal_units(s, buf, buf_size, avctx);
+    is_dummy_buf = (is_dummy_buf && (dummy_buf == buf));
+
+    if (!is_dummy_buf)
+        parse_nal_units(s, buf, buf_size, avctx);
 
     *poutbuf      = buf;
     *poutbuf_size = buf_size;