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).
This commit is contained in:
Edward Hervey 2011-01-30 16:17:19 +01:00
parent 10ec322c64
commit 67f754a9ea

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