From 20528da413e68cbff9d2eb1da3257c0e0025b4cd Mon Sep 17 00:00:00 2001 From: Zhang Xingtao Date: Tue, 12 Apr 2016 23:48:35 +0800 Subject: GStreamer camerabin: return the proper camera source - return m_cameraSrc for function cameraSource() instead of m_videoSrc. m_videoSrc is not always assigned(default 0), it will crash on: if (g_object_class_find_property( G_OBJECT_GET_CLASS(m_session->cameraSource()), "exposure-mode")) { And as the function name says, it would be better to return the value m_cameraSrc. - make sure pointers are not NULL before using them. Change-Id: I8a56db34a805724b428409b87de7d072ee7bfa57 Reviewed-by: Yoann Lopes --- src/plugins/gstreamer/camerabin/camerabinsession.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/gstreamer/camerabin/camerabinsession.cpp') diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 3dd200c54..96b31e1b3 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -514,7 +514,8 @@ GstElement *CameraBinSession::buildCameraSource() if (!m_videoSrc) m_videoSrc = gst_element_factory_make("v4l2src", "camera_source"); - g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL); + if (m_videoSrc) + g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL); } if (m_videoSrc) -- cgit v1.2.3