# HG changeset patch # User reimar # Date 1297000325 0 # Node ID 9cc2689e5cd17a12edbbaccf0887425851a73acc # Parent 15060bd7df4cf2f2b94c32f1c7c06ad91ec1b983 Fix r32587: the previous approach to return subtitles in time broke DVB subtitles due to returning incomplete packets and even for PGS subtitles resulted in incorrect pts values for the sub packets. diff -r 15060bd7df4c -r 9cc2689e5cd1 libmpdemux/demux_ts.c --- a/libmpdemux/demux_ts.c Sun Feb 06 13:09:09 2011 +0000 +++ b/libmpdemux/demux_ts.c Sun Feb 06 13:52:05 2011 +0000 @@ -2985,11 +2985,6 @@ //IS IT TIME TO QUEUE DATA to the dp_packet? if(is_start && (dp != NULL)) { - // subtitle packets _have_ to be submitted before video, otherwise - // they might get stuck "forever" and subtitles will be completely - // out of sync. - if (is_video) - fill_packet(demuxer, demuxer->sub, &priv->fifo[2].pack, &priv->fifo[2].offset, NULL); retv = fill_packet(demuxer, ds, dp, dp_offset, si); } @@ -3130,6 +3125,9 @@ (*dp)->flags = 0; (*dp)->pos = stream_tell(demuxer->stream); (*dp)->pts = es->pts; + // subtitle packets must be returned immediately if possible + if (is_sub && !tss->payload_size) + retv = fill_packet(demuxer, ds, dp, dp_offset, si); if(retv > 0) return retv; @@ -3171,7 +3169,8 @@ { *dp_offset += sz; - if(*dp_offset >= MAX_PACK_BYTES) + // subtitle packets must be returned immediately if possible + if(*dp_offset >= MAX_PACK_BYTES || (is_sub && !tss->payload_size)) { (*dp)->pts = tss->last_pts; retv = fill_packet(demuxer, ds, dp, dp_offset, si);