[FFmpeg-devel] [PATCH] pthread_frame: don't sync items between threads for intra-only codecs.

Ronald S. Bultje rsbultje at gmail.com
Tue Mar 28 22:06:01 EEST 2017


Intra-only codecs should either be able to read these items from the
bitstream, or they should be set upon codec initialization. In both
cases, syncing these items at runtime is unnecessary.

In practice, this fixes race conditions for decoders that read these
values from the bitstream.
---
 libavcodec/pthread_frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index b618be0..295763a 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -244,7 +244,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
 {
     int err = 0;
 
-    if (dst != src) {
+    if (dst != src && (for_user || !(av_codec_get_codec_descriptor(src)->props & AV_CODEC_PROP_INTRA_ONLY))) {
         dst->time_base = src->time_base;
         dst->framerate = src->framerate;
         dst->width     = src->width;
-- 
2.8.1



More information about the ffmpeg-devel mailing list