]> git.sesse.net Git - ffmpeg/commitdiff
pthread_frame: change the criterium for updating thread contexts
authorAnton Khirnov <anton@khirnov.net>
Tue, 9 Jun 2020 11:08:49 +0000 (13:08 +0200)
committerAnton Khirnov <anton@khirnov.net>
Tue, 7 Jul 2020 09:03:09 +0000 (11:03 +0200)
Currently the next thread's context is updated from the previous one's
if the codec descriptor is not marked as intra-only. That is not
entirely correct, since that property does not necessarily imply
anything about how a specific decoder implementation behaves.

Instead, use the presence of the update_thread_context() callback to
decide whether an update should be performed. Fixes races in CFHD,
should cause no behaviour change in any other decoders.

libavcodec/pthread_frame.c

index 601f1704477755893cb9d87c9f4dd59f660e41ae..3255aa933712f349bc55523418e0c160b080d725 100644 (file)
@@ -246,7 +246,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
 {
     int err = 0;
 
-    if (dst != src && (for_user || !(src->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY))) {
+    if (dst != src && (for_user || src->codec->update_thread_context)) {
         dst->time_base = src->time_base;
         dst->framerate = src->framerate;
         dst->width     = src->width;