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