diff mbox series

[FFmpeg-devel] lavc/libxavs2.c: mark key-frame packets

Message ID 20200727062135.986-1-hwrenx@126.com
State Accepted
Commit 5f8555d156c96d6aa3d42762923311a73b4d469c
Headers show
Series [FFmpeg-devel] lavc/libxavs2.c: mark key-frame packets | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

hwren July 27, 2020, 6:21 a.m. UTC
From: hwren <hwrenx@126.com>

Signed-off-by: hwren <hwrenx@126.com>
---
 libavcodec/libxavs2.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Steven Liu July 27, 2020, 7:26 a.m. UTC | #1
<hwrenx@126.com> 于2020年7月27日周一 下午2:22写道:
>
> From: hwren <hwrenx@126.com>
>
> Signed-off-by: hwren <hwrenx@126.com>
> ---
>  libavcodec/libxavs2.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
> index 76b57e731e..8519f6925a 100644
> --- a/libavcodec/libxavs2.c
> +++ b/libavcodec/libxavs2.c
> @@ -223,6 +223,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>          pkt->pts = cae->packet.pts;
>          pkt->dts = cae->packet.dts;
>
> +        if (cae->packet.type == XAVS2_TYPE_IDR ||
> +            cae->packet.type == XAVS2_TYPE_I ||
Don't support OpenGOP?
> +            cae->packet.type == XAVS2_TYPE_KEYFRAME) {
> +            pkt->flags |= AV_PKT_FLAG_KEY;
> +        }
> +
>          memcpy(pkt->data, cae->packet.stream, cae->packet.len);
>          pkt->size = cae->packet.len;
>
> --
> 2.23.0.windows.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
hwren July 27, 2020, 7:58 a.m. UTC | #2
在 2020-07-27 15:26:24,"Steven Liu" <lingjiujianke@gmail.com> 写道:
><hwrenx@126.com> 于2020年7月27日周一 下午2:22写道:
>>
>> From: hwren <hwrenx@126.com>
>>
>> Signed-off-by: hwren <hwrenx@126.com>
>> ---
>>  libavcodec/libxavs2.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
>> index 76b57e731e..8519f6925a 100644
>> --- a/libavcodec/libxavs2.c
>> +++ b/libavcodec/libxavs2.c
>> @@ -223,6 +223,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>>          pkt->pts = cae->packet.pts;
>>          pkt->dts = cae->packet.dts;
>>
>> +        if (cae->packet.type == XAVS2_TYPE_IDR ||
>> +            cae->packet.type == XAVS2_TYPE_I ||
>Don't support OpenGOP?

There is no obvious difference between IDR/I frame in AVS2. Actually we will use TYPE_I in most cases.
So I think, when a jump occurs, ffmpeg just needs to find the closest I frame. Then the decoder will
determine the validity and discard the illegal frames. This method may trigger some error reports,
but they should be harmless.

>> +            cae->packet.type == XAVS2_TYPE_KEYFRAME) {
>> +            pkt->flags |= AV_PKT_FLAG_KEY;
>> +        }
>> +
>>          memcpy(pkt->data, cae->packet.stream, cae->packet.len);
>>          pkt->size = cae->packet.len;
>>
>> --
>> 2.23.0.windows.1
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Steven Liu July 27, 2020, 8:57 a.m. UTC | #3
hwren <hwrenx@126.com> 于2020年7月27日周一 下午3:59写道:
>
>

>
> 在 2020-07-27 15:26:24,"Steven Liu" <lingjiujianke@gmail.com> 写道:
> ><hwrenx@126.com> 于2020年7月27日周一 下午2:22写道:
> >>
> >> From: hwren <hwrenx@126.com>
> >>
> >> Signed-off-by: hwren <hwrenx@126.com>
> >> ---
> >>  libavcodec/libxavs2.c | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >>
> >> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
> >> index 76b57e731e..8519f6925a 100644
> >> --- a/libavcodec/libxavs2.c
> >> +++ b/libavcodec/libxavs2.c
> >> @@ -223,6 +223,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> >>          pkt->pts = cae->packet.pts;
> >>          pkt->dts = cae->packet.dts;
> >>
> >> +        if (cae->packet.type == XAVS2_TYPE_IDR ||
> >> +            cae->packet.type == XAVS2_TYPE_I ||
> >Don't support OpenGOP?
>
> There is no obvious difference between IDR/I frame in AVS2. Actually we will use TYPE_I in most cases.
> So I think, when a jump occurs, ffmpeg just needs to find the closest I frame. Then the decoder will
> determine the validity and discard the illegal frames. This method may trigger some error reports,
> but they should be harmless.

Looks ok then.
>
> >> +            cae->packet.type == XAVS2_TYPE_KEYFRAME) {
> >> +            pkt->flags |= AV_PKT_FLAG_KEY;
> >> +        }
> >> +
> >>          memcpy(pkt->data, cae->packet.stream, cae->packet.len);
> >>          pkt->size = cae->packet.len;
> >>
> >> --
> >> 2.23.0.windows.1
> >>

Thanks for your clarify respond

Thanks
Steven
Michael Niedermayer July 28, 2020, 7:51 p.m. UTC | #4
On Mon, Jul 27, 2020 at 04:57:29PM +0800, Steven Liu wrote:
> hwren <hwrenx@126.com> 于2020年7月27日周一 下午3:59写道:
> >
> >
> 
> >
> > 在 2020-07-27 15:26:24,"Steven Liu" <lingjiujianke@gmail.com> 写道:
> > ><hwrenx@126.com> 于2020年7月27日周一 下午2:22写道:
> > >>
> > >> From: hwren <hwrenx@126.com>
> > >>
> > >> Signed-off-by: hwren <hwrenx@126.com>
> > >> ---
> > >>  libavcodec/libxavs2.c | 6 ++++++
> > >>  1 file changed, 6 insertions(+)
> > >>
> > >> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
> > >> index 76b57e731e..8519f6925a 100644
> > >> --- a/libavcodec/libxavs2.c
> > >> +++ b/libavcodec/libxavs2.c
> > >> @@ -223,6 +223,12 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
> > >>          pkt->pts = cae->packet.pts;
> > >>          pkt->dts = cae->packet.dts;
> > >>
> > >> +        if (cae->packet.type == XAVS2_TYPE_IDR ||
> > >> +            cae->packet.type == XAVS2_TYPE_I ||
> > >Don't support OpenGOP?
> >
> > There is no obvious difference between IDR/I frame in AVS2. Actually we will use TYPE_I in most cases.
> > So I think, when a jump occurs, ffmpeg just needs to find the closest I frame. Then the decoder will
> > determine the validity and discard the illegal frames. This method may trigger some error reports,
> > but they should be harmless.
> 
> Looks ok then.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index 76b57e731e..8519f6925a 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -223,6 +223,12 @@  static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         pkt->pts = cae->packet.pts;
         pkt->dts = cae->packet.dts;
 
+        if (cae->packet.type == XAVS2_TYPE_IDR ||
+            cae->packet.type == XAVS2_TYPE_I ||
+            cae->packet.type == XAVS2_TYPE_KEYFRAME) {
+            pkt->flags |= AV_PKT_FLAG_KEY;
+        }
+
         memcpy(pkt->data, cae->packet.stream, cae->packet.len);
         pkt->size = cae->packet.len;