asfdemux: Use the average frame duration for buffers without a duration.
authorEdward Hervey <bilboed@bilboed.com>
Sun, 28 Jun 2009 15:04:00 +0000 (17:04 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Sun, 28 Jun 2009 15:33:51 +0000 (17:33 +0200)
This will still cause some timestamp jitter, but giving a hint as to the duration
rather than nothing seems to be a better idea.
Also, this allows some scenarios (like remuxing with asfmux) to estimate the total
duration using the accumulated packet duration (which will be correct).

gst/asfdemux/gstasfdemux.c

index 3debb461020923181ab312efdfcc3f400d9f11fc..8300b0a234ec65a0d89264ad310450efd046d934 100644 (file)
@@ -1314,7 +1314,11 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
      * position reporting if a live src is playing not so live content
      * (e.g. rtspsrc taking some time to fall back to tcp) */
     GST_BUFFER_TIMESTAMP (payload->buf) = payload->ts + demux->in_gap;
-    GST_BUFFER_DURATION (payload->buf) = payload->duration;
+    if (payload->duration == GST_CLOCK_TIME_NONE)
+      GST_BUFFER_DURATION (payload->buf) =
+          stream->ext_props.avg_time_per_frame * 100;
+    else
+      GST_BUFFER_DURATION (payload->buf) = payload->duration;
 
     /* FIXME: we should really set durations on buffers if we can */