From 19f27f94ee72c3f87c8eb474fcbada310e9dee3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 6 Feb 2020 09:52:31 +0100 Subject: [PATCH] videoencoder: protect the use of num_subframes change stream lock location to protect the use of frame->abidata.ABI.num_subframes --- gst-libs/gst/video/gstvideoencoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index 960d89b683..e9576090fa 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -2486,6 +2486,8 @@ gst_video_encoder_finish_subframe (GstVideoEncoder * encoder, g_return_val_if_fail (frame->output_buffer, GST_FLOW_ERROR); subframe_buffer = frame->output_buffer; + + GST_VIDEO_ENCODER_STREAM_LOCK (encoder); discont = (frame->presentation_frame_number == 0 && frame->abidata.ABI.num_subframes == 0); @@ -2497,8 +2499,6 @@ gst_video_encoder_finish_subframe (GstVideoEncoder * encoder, frame->presentation_frame_number, GST_TIME_ARGS (frame->pts), GST_TIME_ARGS (frame->dts), GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame)); - GST_VIDEO_ENCODER_STREAM_LOCK (encoder); - ret = gst_video_encoder_can_push_unlocked (encoder); if (ret != GST_FLOW_OK) goto done;