va: baseenc: Add is_live field to check the live stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4359>
This commit is contained in:
He Junyan 2023-04-24 16:56:16 +08:00 committed by Víctor Manuel Jáquez Leal
parent 556a254e59
commit a73474827b
2 changed files with 10 additions and 0 deletions

View file

@ -778,6 +778,7 @@ static gboolean
gst_va_base_enc_set_format (GstVideoEncoder * venc, GstVideoCodecState * state)
{
GstVaBaseEnc *base = GST_VA_BASE_ENC (venc);
GstQuery *query;
g_return_val_if_fail (state->caps != NULL, FALSE);
@ -798,6 +799,13 @@ gst_va_base_enc_set_format (GstVideoEncoder * venc, GstVideoCodecState * state)
gst_video_codec_state_unref (base->input_state);
base->input_state = gst_video_codec_state_ref (state);
/* in case live streaming, we should run on low-latency mode */
base->is_live = FALSE;
query = gst_query_new_latency ();
if (gst_pad_peer_query (GST_VIDEO_ENCODER_SINK_PAD (venc), query))
gst_query_parse_latency (query, &base->is_live, NULL, NULL);
gst_query_unref (query);
if (!gst_va_base_enc_reset (base))
return FALSE;

View file

@ -54,6 +54,8 @@ struct _GstVaBaseEnc
gboolean reconf;
gboolean is_live;
VAProfile profile;
gint width;
gint height;