diff options
author | Havoc Pennington <hp@pobox.com> | 2010-06-16 11:09:17 -0400 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2010-06-16 17:48:47 +0200 |
commit | 9b9f9d0a2a93365e2577c5bad8591f82bbf9e6d0 (patch) | |
tree | 1b631979c02dac394c725c32a00be12fbd5b02d5 | |
parent | a69e419c8eaf61b66c5889f5b635bfe8e97d3f71 (diff) |
v4l2src: in negotiate, check for error return from set_caps
Fixes #621723 (partially)
set_caps can fail if the video device is running, in that case
setting its format leads to EBUSY.
If set_caps fails then we will not have set up the buffer pool
(it will be NULL) which leads to a crash when we try to pull
buffers. If we fail the negotiate on set_caps failure, then we
won't go to playing state and won't crash.
This is a small improvement. Of course, a nicer fix would
be to make set_caps work in the case where the format is
unchanged. If the format has changed, failing is
probably correct because we need to close the device
(go to NULL state) in order to set caps.
-rw-r--r-- | sys/v4l2/gstv4l2src.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 100715ba9..30dd050b1 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -516,8 +516,8 @@ gst_v4l2src_negotiate (GstBaseSrc * basesrc) result = TRUE; } else if (gst_caps_is_fixed (caps)) { /* yay, fixed caps, use those then */ - gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps); - result = TRUE; + if (gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps)) + result = TRUE; } } gst_caps_unref (caps); |