v4l2videoenc: set GstVideoCodecFrame sync point flag

The V4L2 elements already set the delta unit buffer flag when dequeueing
the buffer, but gst_video_encoder_finish_frame overwrites it from the
passed codec frame's sync point flag. Set the flag correctly.
This commit is contained in:
Philipp Zabel 2018-06-25 17:49:07 +02:00 committed by Nicolas Dufresne
parent d5ce10240a
commit 16e5b32bc1

View file

@ -661,6 +661,15 @@ gst_v4l2_video_enc_loop (GstVideoEncoder * encoder)
frame = gst_v4l2_video_enc_get_oldest_frame (encoder);
if (frame) {
/* At this point, the delta unit buffer flag is already correctly set by
* gst_v4l2_buffer_pool_process. Since gst_video_encoder_finish_frame
* will overwrite it from GST_VIDEO_CODEC_FRAME_IS_SYNC_POINT (frame),
* set that here.
*/
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT))
GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT (frame);
else
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
frame->output_buffer = buffer;
buffer = NULL;
ret = gst_video_encoder_finish_frame (encoder, frame);