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).
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);
}