Hi, On Thu, Apr 6, 2017 at 11:36 AM, wm4 <nfx...@googlemail.com> wrote:
> Consider the following sequence of events: > > - open a codec without AV_CODEC_CAP_DELAY > - decode call fails with an error > - ff_thread_flush() is called > - drain packet is sent > > Then the last step would make ff_thread_decode_frame() return an error, > because p->result can still be set to an error value. This is because > submit_packet returns immediately if AV_CODEC_CAP_DELAY is not set, and > no worker thread gets the chance to reset p->result, yet its value is > trusted by ff_thread_decode_frame(). > > Fix this by clearing the error fields on flush. > --- > libavcodec/pthread_frame.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c > index 9a6b83ac45..7586f00bec 100644 > --- a/libavcodec/pthread_frame.c > +++ b/libavcodec/pthread_frame.c > @@ -859,6 +859,7 @@ void ff_thread_flush(AVCodecContext *avctx) > // Make sure decode flush calls with size=0 won't return old > frames > p->got_frame = 0; > av_frame_unref(p->frame); > + p->result = 0; > > release_delayed_buffers(p); > > -- > 2.11.0 Nice catch - I think that looks good. Ronald _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel