mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
v4l2src: handle latency query before setting up the bufferpool
Fixes crash if no bufferpool is set up yet. https://bugzilla.gnome.org/show_bug.cgi?id=684430
This commit is contained in:
parent
c9821d31f8
commit
5d1ed54814
1 changed files with 3 additions and 2 deletions
|
@ -624,7 +624,7 @@ gst_v4l2src_query (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
case GST_QUERY_LATENCY:{
|
case GST_QUERY_LATENCY:{
|
||||||
GstClockTime min_latency, max_latency;
|
GstClockTime min_latency, max_latency;
|
||||||
guint32 fps_n, fps_d;
|
guint32 fps_n, fps_d;
|
||||||
guint num_buffers;
|
guint num_buffers = 0;
|
||||||
|
|
||||||
/* device must be open */
|
/* device must be open */
|
||||||
if (!GST_V4L2_IS_OPEN (obj)) {
|
if (!GST_V4L2_IS_OPEN (obj)) {
|
||||||
|
@ -647,7 +647,8 @@ gst_v4l2src_query (GstBaseSrc * bsrc, GstQuery * query)
|
||||||
min_latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
|
min_latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
|
||||||
|
|
||||||
/* max latency is total duration of the frame buffer */
|
/* max latency is total duration of the frame buffer */
|
||||||
num_buffers = GST_V4L2_BUFFER_POOL_CAST (obj->pool)->num_buffers;
|
if (obj->pool != NULL)
|
||||||
|
num_buffers = GST_V4L2_BUFFER_POOL_CAST (obj->pool)->num_buffers;
|
||||||
|
|
||||||
if (num_buffers == 0)
|
if (num_buffers == 0)
|
||||||
max_latency = -1;
|
max_latency = -1;
|
||||||
|
|
Loading…
Reference in a new issue