Module: gst-plugins-ugly
Branch: master
Commit: 67f754a9ea60052a023dfb2a3cc919bda80dbea8
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=67f754a9ea60052a023dfb2a3cc919bda80dbea8
Author: Edward Hervey <bi...@bi...>
Date: Sun Jan 30 16:17:19 2011 +0100
asfpacket: Avoid using broken duration extension
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 | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gst/asfdemux/asfpacket.c b/gst/asfdemux/asfpacket.c
index 2b16a3f..b56c81a 100644
--- a/gst/asfdemux/asfpacket.c
+++ b/gst/asfdemux/asfpacket.c
@@ -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);
}
|