videoencoder: Use video marker flag to signal end of frame

This marker is optional, its name refer to RTP marker bit. This mark can
be use to reduce latency in various use cases. With the split between
finish_frame() and finish_subframe() we will now be able to identitfy
the last subframe with no latency.

In order to detail the use of GST_BUFFER_FLAG_MARKER in a video
use case, the flag GST_VIDEO_BUFFER_FLAG_MARKER has been introduced
with a proper documentation clarifying marker's role.
This commit is contained in:
Stéphane Cerveau 2019-09-25 10:45:28 +02:00 committed by GStreamer Merge Bot
parent 3e32896912
commit 7013a58874
2 changed files with 10 additions and 0 deletions

View file

@ -2392,6 +2392,12 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
GST_BUFFER_DTS (frame->output_buffer) = frame->dts;
GST_BUFFER_DURATION (frame->output_buffer) = frame->duration;
/* At this stage we have a full frame in subframe use case ,
* let's mark it to enabled some latency optimization
* in some uses cases like RTP. */
GST_BUFFER_FLAG_SET (frame->output_buffer, GST_VIDEO_BUFFER_FLAG_MARKER);
GST_OBJECT_LOCK (encoder);
/* update rate estimate */
priv->bytes += gst_buffer_get_size (frame->output_buffer);

View file

@ -176,6 +176,8 @@ gboolean gst_video_frame_copy_plane (GstVideoFrame *dest, const GstVideoFr
* @GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD: The video frame has the bottom field only. This is
* the same as GST_VIDEO_BUFFER_FLAG_ONEFIELD
* (GST_VIDEO_BUFFER_FLAG_TFF flag unset) (Since: 1.16).
* @GST_VIDEO_BUFFER_FLAG_MARKER: The #GstBuffer contains the end of a video field or frame
* boundary such as the last subframe or packet (Since: 1.18).
* @GST_VIDEO_BUFFER_FLAG_LAST: Offset to define more flags
*
* Additional video buffer flags. These flags can potentially be used on any
@ -197,6 +199,8 @@ typedef enum {
GST_VIDEO_BUFFER_FLAG_ONEFIELD,
GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD = GST_VIDEO_BUFFER_FLAG_ONEFIELD,
GST_VIDEO_BUFFER_FLAG_MARKER = GST_BUFFER_FLAG_MARKER,
GST_VIDEO_BUFFER_FLAG_LAST = (GST_BUFFER_FLAG_LAST << 8)
} GstVideoBufferFlags;