summaryrefslogtreecommitdiff
path: root/recipes/gstreamer/gst-plugins-good/fix-unit-scale-asseration.patch
blob: 749c4918a978f7bf99be0077b17dcec689e2b15b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff -uNr gst-plugins-good-0.10.15/sys/v4l2/gstv4l2src.c gst-plugins-good-0.10.15.new/sys/v4l2/gstv4l2src.c
--- gst-plugins-good-0.10.15/sys/v4l2/gstv4l2src.c	2009-05-11 19:00:07.000000000 -0500
+++ gst-plugins-good-0.10.15.new/sys/v4l2/gstv4l2src.c	2009-06-22 09:51:50.000000000 -0500
@@ -1377,14 +1377,22 @@
       timestamp = gst_clock_get_time (clock) - timestamp;
       gst_object_unref (clock);
 
-      latency =
-          gst_util_uint64_scale_int (GST_SECOND, v4l2src->fps_d,
-          v4l2src->fps_n);
+      /* we must have a framerate */
+      if (v4l2src->fps_n <= 0 || v4l2src->fps_d <= 0) {
+        GST_WARNING_OBJECT (src,
+            "Can't give latency since framerate isn't fixated !");
+        timestamp = GST_CLOCK_TIME_NONE;
+      }
+      else {
+        latency =
+            gst_util_uint64_scale_int (GST_SECOND, v4l2src->fps_d,
+            v4l2src->fps_n);
 
-      if (timestamp > latency)
-        timestamp -= latency;
-      else
-        timestamp = 0;
+        if (timestamp > latency)
+          timestamp -= latency;
+        else
+          timestamp = 0;
+      }
     }
 
     /* FIXME: use the timestamp from the buffer itself! */