[cheese] Fix cheese_camera_device_update_format_table loop



commit 22fb392d2393019016420e158f90b3f7bf561cde
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Aug 22 10:02:08 2012 +0200

    Fix cheese_camera_device_update_format_table loop
    
    Some devices report a very small min_width / height down to reporting
    0x0 as minimum resolution, which causes an infinite loop in
    cheese_camera_device_update_format_table().
    
    This patch limits the minimum resultion to 160x120, both to fix the
    infinite loop issue, and to remove ridiculous resolutions such as 2x2,
    5x3, 11x7, 22x15 etc. which are seen in the resolution drop down on some
    devices.
    
    For more details on the infinite loop issue, see:
    https://bugzilla.redhat.com/show_bug.cgi?id=850505
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 libcheese/cheese-camera-device.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
index 9b977a4..653cba9 100644
--- a/libcheese/cheese-camera-device.c
+++ b/libcheese/cheese-camera-device.c
@@ -296,6 +296,14 @@ cheese_camera_device_update_format_table (CheeseCameraDevice *device)
       min_height = gst_value_get_int_range_min (height);
       max_height = gst_value_get_int_range_max (height);
 
+      /* Some devices report a very small min_width / height down to reporting
+       * 0x0 as minimum resolution, which causes an infinte loop below, limit
+       * these to something reasonable. */
+      if (min_width < 160)
+        min_width = 160;
+      if (min_height < 120)
+        min_height = 120;
+
       cur_width  = min_width;
       cur_height = min_height;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]