mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 11:32:51 +00:00
mpegtspacketizer: be more tolerant when parsing the adaptation field
According to the specification, the adaptation field length must be 183 if there is no payload data and < 183 if the packet contains an adaptation field and payload data. Unfortunately some payloaders always set the flag for payload data, even if the adaptation field length is 183. Don't return with an error in this case. Clear the payload data flag instead and parse the adaptation field as usual. This avoids visual artefacts for such streams.
This commit is contained in:
parent
b79c949789
commit
468408c6a6
1 changed files with 12 additions and 1 deletions
|
@ -354,6 +354,17 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 *
|
|||
GST_MEMDUMP ("Unknown payload", packet->data + length,
|
||||
packet->data_end - packet->data - length);
|
||||
}
|
||||
} else if (length == 183) {
|
||||
/* Note: According to the specification, the adaptation field length
|
||||
* must be 183 if there is no payload data and < 183 if the packet
|
||||
* contains an adaptation field and payload data.
|
||||
* Some payloaders always set the flag for payload data, even if the
|
||||
* adaptation field length is 183. This just means a zero length
|
||||
* payload so we clear the payload flag here and continue.
|
||||
*/
|
||||
GST_WARNING ("PID 0x%04x afc == 0x%02x and length %d == 183 (ignored)",
|
||||
packet->pid, packet->scram_afc_cc & 0x30, length);
|
||||
packet->scram_afc_cc &= ~0x10;
|
||||
} else if (length > 182) {
|
||||
GST_WARNING ("PID 0x%04x afc == 0x%02x and length %d > 182",
|
||||
packet->pid, packet->scram_afc_cc & 0x30, length);
|
||||
|
@ -482,7 +493,7 @@ mpegts_packetizer_parse_packet (MpegTSPacketizer2 * packetizer,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (FLAGS_HAS_PAYLOAD (tmp))
|
||||
if (FLAGS_HAS_PAYLOAD (packet->scram_afc_cc))
|
||||
packet->payload = packet->data;
|
||||
else
|
||||
packet->payload = NULL;
|
||||
|
|
Loading…
Reference in a new issue