From f93939b46cedcfe78bad3df4dd55ce410088032a Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Wed, 31 Aug 2011 01:08:39 +0000 Subject: [PATCH] hlsdemux: Send a flush-stop when switching pads. Fixes A->A/V sync issue. This is to ensure that we reset the accumulate segment on the sinks so if we start with audio only then switch to audio+video, then both sinks will have the same segments and will be synchronized. --- gst/hls/gsthlsdemux.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index 8fdf317e67..4ea8bfef2d 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -670,6 +670,18 @@ switch_pads (GstHLSDemux * demux, GstCaps * newcaps) GST_DEBUG ("Switching pads (oldpad:%p)", oldpad); + /* FIXME: This is a workaround for a bug in playsink. + * If we're switching from an audio-only or video-only fragment + * to an audio-video segment, the new sink doesn't know about + * the current running time and audio/video will go out of sync. + * + * This should be fixed in playsink by distributing the + * current running time to newly created sinks and is + * fixed in 0.11 with the new segments. + */ + if (demux->srcpad) + gst_pad_push_event (demux->srcpad, gst_event_new_flush_stop ()); + /* First create and activate new pad */ demux->srcpad = gst_pad_new_from_static_template (&srctemplate, NULL); gst_pad_set_event_function (demux->srcpad,