mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
tsdemux: correctly determine expected PES packet payload size
Avoids consistently failing to detect that a packet is complete, which would then only be pushed upon the start of a next packet, which leads to quite a delay in case of a sparse (subtitle) stream. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=666674
This commit is contained in:
parent
4374a90553
commit
006fe188e7
1 changed files with 5 additions and 2 deletions
|
@ -1300,7 +1300,8 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
|
|||
/* Remove PES headers */
|
||||
GST_DEBUG ("Moving data forward by %d bytes (packet_size:%d, have:%d)",
|
||||
header.header_size, header.packet_length, length);
|
||||
stream->expected_size = header.packet_length;
|
||||
g_assert (header.packet_length >= header.header_size);
|
||||
stream->expected_size = header.packet_length - header.header_size;
|
||||
data += header.header_size;
|
||||
length -= header.header_size;
|
||||
|
||||
|
@ -1582,8 +1583,10 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream,
|
|||
GST_DEBUG ("current_size:%d, expected_size:%d",
|
||||
stream->current_size, stream->expected_size);
|
||||
/* Finally check if the data we queued completes a packet */
|
||||
if (stream->expected_size && stream->current_size == stream->expected_size)
|
||||
if (stream->expected_size && stream->current_size == stream->expected_size) {
|
||||
GST_LOG ("pushing complete packet");
|
||||
res = gst_ts_demux_push_pending_data (demux, stream);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue