Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
On Mon, 19 Sep 2016 21:20:08 +0200 Carl Eugen Hoyoswrote: > 2016-09-19 20:32 GMT+02:00 wm4 : > > > But I guess you don't care, neither did whoever pushed this > > low quality patch before the patch was fixed? > > I believe you didn't oppose the current mailing list rules so > please refrain from personal attacks. > I wouldn't call it a personal attack, rather accusation of carelessness. My tone might have been off though, and I apologize. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
2016-09-19 20:32 GMT+02:00 wm4: > But I guess you don't care, neither did whoever pushed this > low quality patch before the patch was fixed? I believe you didn't oppose the current mailing list rules so please refrain from personal attacks. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
On Tue, 9 Aug 2016 18:48:21 -0700 Sasi Inguvawrote: > Signed-off-by: Sasi Inguva > --- > libavcodec/avcodec.h | 6 ++ > libavcodec/utils.c | 14 +- > libavcodec/version.h | 2 +- > 3 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 3b21537..d68da01 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -1621,6 +1621,12 @@ typedef struct AVPacket { > } AVPacket; > #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe > #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted > +/** > + * Flag is used to discard packets which are required to maintain valid > + * decoder state but are not required for output and should be dropped > + * after decoding. > + **/ > +#define AV_PKT_FLAG_DISCARD 0x0004 > > enum AVSideDataParamChangeFlags { > AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index f7adb52..399cf72 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -784,6 +784,12 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame > *frame) > } > } > add_metadata_from_side_data(pkt, frame); > + > +if (pkt->flags & AV_PKT_FLAG_DISCARD) { > +frame->flags |= AV_FRAME_FLAG_DISCARD; > +} else { > +frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD); > +} Many external decoders won't be able to do this correctly, because they won't call ff_init_buffer_info in the "right moment". They're asynchronous, buffered, opaque. But I guess you don't care, neither did whoever pushed this low quality patch before the patch was fixed? > } else { > frame->pkt_pts = AV_NOPTS_VALUE; > av_frame_set_pkt_pos (frame, -1); > @@ -2248,7 +2254,9 @@ fail: > if(ret == tmp.size) > ret = avpkt->size; > } > - > +if (picture->flags & AV_FRAME_FLAG_DISCARD) { > +*got_picture_ptr = 0; > +} > if (*got_picture_ptr) { > if (!avctx->refcounted_frames) { > int err = unrefcount_frame(avci, picture); > @@ -2412,6 +2420,10 @@ int attribute_align_arg > avcodec_decode_audio4(AVCodecContext *avctx, > avctx->internal->skip_samples = 0; > } > } > + > +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && > avctx->internal->skip_samples <= 0) { > +*got_frame_ptr = 0; > +} > fail: > avctx->internal->pkt = NULL; > if (did_split) { > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 4ded1ee..a697261 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -28,7 +28,7 @@ > #include "libavutil/version.h" > > #define LIBAVCODEC_VERSION_MAJOR 57 > -#define LIBAVCODEC_VERSION_MINOR 51 > +#define LIBAVCODEC_VERSION_MINOR 52 > #define LIBAVCODEC_VERSION_MICRO 100 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
skip_samples shouldn't be negative. But it's not enforced because it is an int field. Changed the condition to equality. Added an assert where skip_samples is populated. On Sun, Aug 14, 2016 at 5:40 AM, Clément Bœschwrote: > On Tue, Aug 09, 2016 at 06:48:21PM -0700, Sasi Inguva wrote: > [...] > > +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && > avctx->internal->skip_samples <= 0) { > > skip_samples can be negative? > > if so, that looks like a behaviour change we want documented > > if not, you probably want to check against 0 equality and add an assert. > > -- > Clément B. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
Signed-off-by: Sasi Inguva--- libavcodec/avcodec.h | 6 ++ libavcodec/utils.c | 15 ++- libavcodec/version.h | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3b21537..d68da01 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1621,6 +1621,12 @@ typedef struct AVPacket { } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted +/** + * Flag is used to discard packets which are required to maintain valid + * decoder state but are not required for output and should be dropped + * after decoding. + **/ +#define AV_PKT_FLAG_DISCARD 0x0004 enum AVSideDataParamChangeFlags { AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f7adb52..a90fe45 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -784,6 +784,12 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) } } add_metadata_from_side_data(pkt, frame); + +if (pkt->flags & AV_PKT_FLAG_DISCARD) { +frame->flags |= AV_FRAME_FLAG_DISCARD; +} else { +frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD); +} } else { frame->pkt_pts = AV_NOPTS_VALUE; av_frame_set_pkt_pos (frame, -1); @@ -2248,7 +2254,9 @@ fail: if(ret == tmp.size) ret = avpkt->size; } - +if (picture->flags & AV_FRAME_FLAG_DISCARD) { +*got_picture_ptr = 0; +} if (*got_picture_ptr) { if (!avctx->refcounted_frames) { int err = unrefcount_frame(avci, picture); @@ -2347,6 +2355,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, _size); if(side && side_size>=10) { avctx->internal->skip_samples = AV_RL32(side); +av_assert1(avctx->internal->skip_samples >= 0); discard_padding = AV_RL32(side + 4); av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n", avctx->internal->skip_samples, (int)discard_padding); @@ -2412,6 +2421,10 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, avctx->internal->skip_samples = 0; } } + +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && avctx->internal->skip_samples == 0) { +*got_frame_ptr = 0; +} fail: avctx->internal->pkt = NULL; if (did_split) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 4ded1ee..a697261 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 51 +#define LIBAVCODEC_VERSION_MINOR 52 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.8.0.rc3.226.g39d4020 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
On Tue, Aug 09, 2016 at 06:48:21PM -0700, Sasi Inguva wrote: [...] > +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && > avctx->internal->skip_samples <= 0) { skip_samples can be negative? if so, that looks like a behaviour change we want documented if not, you probably want to check against 0 equality and add an assert. -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.
Signed-off-by: Sasi Inguva--- libavcodec/avcodec.h | 6 ++ libavcodec/utils.c | 14 +- libavcodec/version.h | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3b21537..d68da01 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1621,6 +1621,12 @@ typedef struct AVPacket { } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted +/** + * Flag is used to discard packets which are required to maintain valid + * decoder state but are not required for output and should be dropped + * after decoding. + **/ +#define AV_PKT_FLAG_DISCARD 0x0004 enum AVSideDataParamChangeFlags { AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f7adb52..399cf72 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -784,6 +784,12 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) } } add_metadata_from_side_data(pkt, frame); + +if (pkt->flags & AV_PKT_FLAG_DISCARD) { +frame->flags |= AV_FRAME_FLAG_DISCARD; +} else { +frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD); +} } else { frame->pkt_pts = AV_NOPTS_VALUE; av_frame_set_pkt_pos (frame, -1); @@ -2248,7 +2254,9 @@ fail: if(ret == tmp.size) ret = avpkt->size; } - +if (picture->flags & AV_FRAME_FLAG_DISCARD) { +*got_picture_ptr = 0; +} if (*got_picture_ptr) { if (!avctx->refcounted_frames) { int err = unrefcount_frame(avci, picture); @@ -2412,6 +2420,10 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, avctx->internal->skip_samples = 0; } } + +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && avctx->internal->skip_samples <= 0) { +*got_frame_ptr = 0; +} fail: avctx->internal->pkt = NULL; if (did_split) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 4ded1ee..a697261 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 51 +#define LIBAVCODEC_VERSION_MINOR 52 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.8.0.rc3.226.g39d4020 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel