examples: gst-camerabin2-test: protect from division by zero
authorLuis de Bethencourt <luis.bg@samsung.com>
Wed, 3 Jun 2015 13:44:31 +0000 (14:44 +0100)
committerLuis de Bethencourt <luis.bg@samsung.com>
Wed, 3 Jun 2015 13:58:13 +0000 (14:58 +0100)
Highly unlikely to have 0 captures, but protect from crashes in the future by
doing none of the math if there is no data.

tests/examples/camerabin2/gst-camerabin2-test.c

index b68ec51b536306ad8848d641fc1c84cbbd32687f..90e010a4423f076911cb92306f62c7ad68ea7646 100644 (file)
@@ -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