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.
This commit is contained in:
Youness Alaoui 2011-08-31 01:08:39 +00:00 committed by Sebastian Dröge
parent ed5a5cc139
commit f93939b46c

View file

@ -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,