mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
wpevideosrc: Handle latency queries
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8217>
This commit is contained in:
parent
f7e70e5261
commit
e908d22c44
1 changed files with 37 additions and 0 deletions
|
@ -797,6 +797,42 @@ gst_wpe_video_src_event (GstBaseSrc * base_src, GstEvent * event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_wpe_video_src_query (GstBaseSrc * base_src, GstQuery * query)
|
||||
{
|
||||
GstWpeVideoSrc *src = GST_WPE_VIDEO_SRC (base_src);
|
||||
GstGLBaseSrc *gl_src = GST_GL_BASE_SRC (base_src);
|
||||
gboolean ret = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_LATENCY:{
|
||||
GST_OBJECT_LOCK (src);
|
||||
if (gl_src->out_info.fps_n > 0) {
|
||||
GstClockTime latency;
|
||||
|
||||
latency = gst_util_uint64_scale (GST_SECOND, gl_src->out_info.fps_d,
|
||||
gl_src->out_info.fps_n);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
gst_query_set_latency (query,
|
||||
gst_base_src_is_live (GST_BASE_SRC_CAST (src)), latency,
|
||||
GST_CLOCK_TIME_NONE);
|
||||
GST_DEBUG_OBJECT (src, "Reporting latency of %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (latency));
|
||||
ret = TRUE;
|
||||
} else {
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ret = GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS, query,
|
||||
(base_src, query), FALSE);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_wpe_video_src_init (GstWpeVideoSrc * src)
|
||||
{
|
||||
|
@ -859,6 +895,7 @@ gst_wpe_video_src_class_init (GstWpeVideoSrcClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_wpe_video_src_decide_allocation);
|
||||
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_wpe_video_src_stop);
|
||||
base_src_class->event = GST_DEBUG_FUNCPTR (gst_wpe_video_src_event);
|
||||
base_src_class->query = GST_DEBUG_FUNCPTR (gst_wpe_video_src_query);
|
||||
|
||||
gl_base_src_class->supported_gl_api =
|
||||
static_cast < GstGLAPI >
|
||||
|
|
Loading…
Reference in a new issue