Index: gst-plugins-good/gst/rtp/gstrtpmp4gdepay.c
===================================================================
RCS file: /usr/local/cvs/linux/libs/gst-plugins-good/gst-plugins-good/gst/rtp/gstrtpmp4gdepay.c,v
retrieving revision 1.1.1.7
diff -u -u -r1.1.1.7 gstrtpmp4gdepay.c
--- gst-plugins-good/gst/rtp/gstrtpmp4gdepay.c	31 Aug 2009 14:41:43 -0000	1.1.1.7
+++ gst-plugins-good/gst/rtp/gstrtpmp4gdepay.c	17 Feb 2010 14:44:44 -0000
@@ -520,12 +520,21 @@
             else
               diff = -(rtpmp4gdepay->prev_rtptime - rtptime);
 
-            /* if no constantDuration was given, make one */
-            if (rtpmp4gdepay->constantDuration == 0) {
-              rtpmp4gdepay->constantDuration = diff / num_AU_headers;
-              GST_DEBUG_OBJECT (depayload, "guessing constantDuration %d",
-                  rtpmp4gdepay->constantDuration);
+            GST_DEBUG_OBJECT (depayload, "diff %d rtptime %d ->prev_rtptime %d",
+                              diff, rtptime, rtpmp4gdepay->prev_rtptime);
+            if (!diff) {
+              /* diff is 0, invent a number; anything is better than a SIGFPE */
+              GST_WARNING_OBJECT (depayload, "diff %d - inventing another delta to avoid a SIGFPE!",
+                                  diff);
+              diff = 2048; /* Becomes 1024 after the averaging below */
             }
+            /* average the constantDuration so strange timestamps on the first
+             * packets dont have such a huge impact in the long run.
+             */
+            rtpmp4gdepay->constantDuration = (rtpmp4gdepay->constantDuration +
+                                              diff / num_AU_headers) / 2;
+            GST_DEBUG_OBJECT (depayload, "constantDuration now %d",
+                              rtpmp4gdepay->constantDuration);
 
             /* get the number of packets by dividing with the duration */
             diff /= rtpmp4gdepay->constantDuration;
