94c1e23
From 9c2b429ec0b027657c0767103fbbfebbc8a992ed Mon Sep 17 00:00:00 2001
94c1e23
From: Hans de Goede <hdegoede@redhat.com>
94c1e23
Date: Wed, 22 Aug 2012 10:02:08 +0200
94c1e23
Subject: [PATCH 3/4] Fix cheese_camera_device_update_format_table() going
94c1e23
 into an infinite loop
94c1e23
94c1e23
Some devices report a very small min_width / height down to reporting
94c1e23
0x0 as minimum resolution, which causes an infinte loop in
94c1e23
cheese_camera_device_update_format_table().
94c1e23
94c1e23
This patch limits the minimum resultion to 160x120, both to fix the
94c1e23
infinite loop issue, and to remove ridiculous resolutions such as
94c1e23
2x2, 5x3, 11x7, 22x15 etc. which are seen in the resolution drop down on
94c1e23
some devices.
94c1e23
94c1e23
For more details on the infinite loop issue, see:
94c1e23
https://bugzilla.redhat.com/show_bug.cgi?id=850505
94c1e23
94c1e23
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
94c1e23
---
94c1e23
 libcheese/cheese-camera-device.c | 8 ++++++++
94c1e23
 1 file changed, 8 insertions(+)
94c1e23
94c1e23
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
94c1e23
index 9b977a4..653cba9 100644
94c1e23
--- a/libcheese/cheese-camera-device.c
94c1e23
+++ b/libcheese/cheese-camera-device.c
94c1e23
@@ -296,6 +296,14 @@ cheese_camera_device_update_format_table (CheeseCameraDevice *device)
94c1e23
       min_height = gst_value_get_int_range_min (height);
94c1e23
       max_height = gst_value_get_int_range_max (height);
94c1e23
 
94c1e23
+      /* Some devices report a very small min_width / height down to reporting
94c1e23
+       * 0x0 as minimum resolution, which causes an infinte loop below, limit
94c1e23
+       * these to something reasonable. */
94c1e23
+      if (min_width < 160)
94c1e23
+        min_width = 160;
94c1e23
+      if (min_height < 120)
94c1e23
+        min_height = 120;
94c1e23
+
94c1e23
       cur_width  = min_width;
94c1e23
       cur_height = min_height;
94c1e23
 
94c1e23
-- 
94c1e23
1.7.11.4
94c1e23