changeset 32500:2b6d7ed36156

Fix subtitle sync issues by ensuring we enqueue all subtitle packets before demuxing the next video packet.
author reimar
date Sat, 06 Nov 2010 16:38:00 +0000
parents 4be4c1ecaa4c
children 8352a5ed347a
files libmpdemux/demux_ts.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ts.c	Sat Nov 06 16:05:00 2010 +0000
+++ b/libmpdemux/demux_ts.c	Sat Nov 06 16:38:00 2010 +0000
@@ -2963,6 +2963,11 @@
 			//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);
 			}