Message ID | 20200910203904.17757-1-onemda@gmail.com |
---|---|
State | Accepted |
Commit | bd7d832e84598fbcce06cebb1d730dad5d3db1ce |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/mobiclip: add missing flush | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 9/10/2020 5:39 PM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol <onemda@gmail.com> > --- > libavcodec/mobiclip.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c > index d147eddbae..c296ce3c78 100644 > --- a/libavcodec/mobiclip.c > +++ b/libavcodec/mobiclip.c > @@ -1389,6 +1389,14 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data, > return 0; > } > > +static void mobiclip_flush(AVCodecContext *avctx) > +{ > + MobiClipContext *s = avctx->priv_data; > + > + for (int i = 0; i < 6; i++) > + av_frame_unref(s->pic[i]); Shouldn't you also zero s->current_pic? It's used as an index for this array. > +} > + > static av_cold int mobiclip_close(AVCodecContext *avctx) > { > MobiClipContext *s = avctx->priv_data; > @@ -1421,6 +1429,7 @@ AVCodec ff_mobiclip_decoder = { > .priv_data_size = sizeof(MobiClipContext), > .init = mobiclip_init, > .decode = mobiclip_decode, > + .flush = mobiclip_flush, > .close = mobiclip_close, > .capabilities = AV_CODEC_CAP_DR1, > }; >
On Sun, Sep 13, 2020 at 12:13:23PM -0300, James Almer wrote: > On 9/10/2020 5:39 PM, Paul B Mahol wrote: > > Signed-off-by: Paul B Mahol <onemda@gmail.com> > > --- > > libavcodec/mobiclip.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c > > index d147eddbae..c296ce3c78 100644 > > --- a/libavcodec/mobiclip.c > > +++ b/libavcodec/mobiclip.c > > @@ -1389,6 +1389,14 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data, > > return 0; > > } > > > > +static void mobiclip_flush(AVCodecContext *avctx) > > +{ > > + MobiClipContext *s = avctx->priv_data; > > + > > + for (int i = 0; i < 6; i++) > > + av_frame_unref(s->pic[i]); > > Shouldn't you also zero s->current_pic? It's used as an index for this > array. Not really required as it is not important, it cycles/wraps around. > > > +} > > + > > static av_cold int mobiclip_close(AVCodecContext *avctx) > > { > > MobiClipContext *s = avctx->priv_data; > > @@ -1421,6 +1429,7 @@ AVCodec ff_mobiclip_decoder = { > > .priv_data_size = sizeof(MobiClipContext), > > .init = mobiclip_init, > > .decode = mobiclip_decode, > > + .flush = mobiclip_flush, > > .close = mobiclip_close, > > .capabilities = AV_CODEC_CAP_DR1, > > }; > > > > _______________________________________________ > 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".
diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c index d147eddbae..c296ce3c78 100644 --- a/libavcodec/mobiclip.c +++ b/libavcodec/mobiclip.c @@ -1389,6 +1389,14 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data, return 0; } +static void mobiclip_flush(AVCodecContext *avctx) +{ + MobiClipContext *s = avctx->priv_data; + + for (int i = 0; i < 6; i++) + av_frame_unref(s->pic[i]); +} + static av_cold int mobiclip_close(AVCodecContext *avctx) { MobiClipContext *s = avctx->priv_data; @@ -1421,6 +1429,7 @@ AVCodec ff_mobiclip_decoder = { .priv_data_size = sizeof(MobiClipContext), .init = mobiclip_init, .decode = mobiclip_decode, + .flush = mobiclip_flush, .close = mobiclip_close, .capabilities = AV_CODEC_CAP_DR1, };
Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavcodec/mobiclip.c | 9 +++++++++ 1 file changed, 9 insertions(+)