diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-08-17 16:09:30 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-08-22 06:53:34 +0000 |
commit | 2af2d8359c835c1d9347c50b89b7c24658858d35 (patch) | |
tree | 5e44e04bd99cc35ba6e0c1329b1e01d8462ed47f /src/plugins/gstreamer | |
parent | b799d36a9e543bccd921399e929ef7ad17f15497 (diff) | |
download | qtmultimedia-2af2d8359c835c1d9347c50b89b7c24658858d35.tar.gz |
Gstreamer: Fix crash when resolution or frame rates are requested
When either resolution or frame rates have been requested when
the camera is in unloaded state, caps might not have some values.
Change-Id: Ie935c62d02e10f762957ecd9f89255ad0e8fbd0b
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/gstreamer')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index e87e1b3f0..cfbc94bb4 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -1294,6 +1294,9 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame GstStructure *structure = gst_caps_get_structure(caps, i); gst_structure_set_name(structure, "video/x-raw"); const GValue *oldRate = gst_structure_get_value(structure, "framerate"); + if (!oldRate) + continue; + GValue rate; memset(&rate, 0, sizeof(rate)); g_value_init(&rate, G_VALUE_TYPE(oldRate)); @@ -1310,6 +1313,9 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame for (uint i=0; i<gst_caps_get_size(caps); i++) { GstStructure *structure = gst_caps_get_structure(caps, i); const GValue *rateValue = gst_structure_get_value(structure, "framerate"); + if (!rateValue) + continue; + readValue(rateValue, &res, continuous); } @@ -1401,6 +1407,9 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate, gst_structure_set_name(structure, "video/x-raw"); const GValue *oldW = gst_structure_get_value(structure, "width"); const GValue *oldH = gst_structure_get_value(structure, "height"); + if (!oldW || !oldH) + continue; + GValue w; memset(&w, 0, sizeof(GValue)); GValue h; @@ -1425,6 +1434,8 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate, GstStructure *structure = gst_caps_get_structure(caps, i); const GValue *wValue = gst_structure_get_value(structure, "width"); const GValue *hValue = gst_structure_get_value(structure, "height"); + if (!wValue || !hValue) + continue; QPair<int,int> wRange = valueRange(wValue, &isContinuous); QPair<int,int> hRange = valueRange(hValue, &isContinuous); |