videoencoder: protect the use of num_subframes
authorStéphane Cerveau <scerveau@collabora.com>
Thu, 6 Feb 2020 08:52:31 +0000 (09:52 +0100)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 24 Feb 2020 20:37:38 +0000 (20:37 +0000)
change stream lock location to protect the use of
frame->abidata.ABI.num_subframes

gst-libs/gst/video/gstvideoencoder.c

index 960d89b..e957609 100644 (file)
@@ -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;