From: Wim Taymans Date: Fri, 22 Mar 2013 11:16:45 +0000 (+0100) Subject: fluidsynth: reset on flush and state change X-Git-Tag: 1.19.3~507^2~13931 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87041064f8095a5bd4b92069d1839c2e21ad9642;p=platform%2Fupstream%2Fgstreamer.git fluidsynth: reset on flush and state change --- diff --git a/ext/fluidsynth/gstfluidsynth.c b/ext/fluidsynth/gstfluidsynth.c index 23b86b3..f7d4df1 100644 --- a/ext/fluidsynth/gstfluidsynth.c +++ b/ext/fluidsynth/gstfluidsynth.c @@ -294,6 +294,13 @@ gst_fluidsynth_clip_buffer (GstFluidsynth * fluidsynth, GstBuffer * buffer) } #endif +static void +gst_fluidsynth_reset (GstFluidsynth * fluidsynth) +{ + fluid_synth_system_reset (fluidsynth->synth); + fluidsynth->last_pts = GST_CLOCK_TIME_NONE; +} + static gboolean gst_fluidsynth_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { @@ -325,6 +332,10 @@ gst_fluidsynth_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) fluidsynth->segment); res = gst_pad_event_default (pad, parent, event); break; + case GST_EVENT_FLUSH_STOP: + gst_fluidsynth_reset (fluidsynth); + res = gst_pad_event_default (pad, parent, event); + break; case GST_EVENT_EOS: /* FIXME, push last samples */ res = gst_pad_event_default (pad, parent, event); @@ -583,6 +594,7 @@ gst_fluidsynth_change_state (GstElement * element, GstStateChange transition) goto open_failed; break; case GST_STATE_CHANGE_READY_TO_PAUSED: + gst_fluidsynth_reset (fluidsynth); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: break;