summaryrefslogtreecommitdiff
path: root/tests/examples/camerabin2
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis.bg@samsung.com>2015-06-03 14:44:31 +0100
committerLuis de Bethencourt <luis.bg@samsung.com>2015-06-03 14:58:13 +0100
commit16f61e7b2d6cc863e1ef53bf3f1132f3aa5bfd5f (patch)
treeeff3912dcd2a5824fd8ae357dbdcfe4b10e72a44 /tests/examples/camerabin2
parentacf0d92d0f4af0fe7f26db44eac406804353c55f (diff)
examples: gst-camerabin2-test: protect from division by zero
Highly unlikely to have 0 captures, but protect from crashes in the future by doing none of the math if there is no data.
Diffstat (limited to 'tests/examples/camerabin2')
-rw-r--r--tests/examples/camerabin2/gst-camerabin2-test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/examples/camerabin2/gst-camerabin2-test.c b/tests/examples/camerabin2/gst-camerabin2-test.c
index b68ec51b5..90e010a44 100644
--- a/tests/examples/camerabin2/gst-camerabin2-test.c
+++ b/tests/examples/camerabin2/gst-camerabin2-test.c
@@ -723,8 +723,7 @@ setup_pipeline (void)
if (ipp) {
g_object_set (camerabin, "image-filter", ipp, NULL);
g_object_unref (ipp);
- }
- else
+ } else
GST_WARNING ("Could not create ipp elements");
}
@@ -1077,6 +1076,9 @@ print_performance_data (void)
i++;
}
+ if (i == 0)
+ return;
+
if (i > 1)
shot_to_shot = avg.shot_to_shot / (i - 1);
else