]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugins-ugly0-10.git/commitdiff
asfpacket: Avoid using broken duration extension
authorEdward Hervey <bilboed@bilboed.com>
Sun, 30 Jan 2011 15:17:19 +0000 (16:17 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Sun, 30 Jan 2011 15:17:19 +0000 (16:17 +0100)
Quite a few (broken?) files have a packet duration of 1ms, which is
most definitely wrong for either audio or video packets.

We therefore avoid using that value and instead use other metrics to
determine the buffer duration (like using the extended stream properties
average frame duration if present and valid).

gst/asfdemux/asfpacket.c

index 2b16a3f6025128c4c07e98046d7c68f643f88703..b56c81a7982eca293c8688eb9ea987185a80f9fb 100644 (file)
@@ -226,8 +226,10 @@ asf_payload_parse_replicated_data_extensions (AsfStream * stream,
     switch (ext->id) {
       case ASF_PAYLOAD_EXTENSION_DURATION:
         if (G_LIKELY (ext->len == 2)) {
-          payload->duration =
-              GST_READ_UINT16_LE (payload->rep_data + off) * GST_MSECOND;
+          guint16 tdur = GST_READ_UINT16_LE (payload->rep_data + off);
+          /* packet durations of 1ms are mostly invalid */
+          if (tdur != 1)
+            payload->duration = tdur * GST_MSECOND;
         } else {
           GST_WARNING ("unexpected DURATION extensions len %u", ext->len);
         }