fluidsynth: reset on flush and state change

This commit is contained in:
Wim Taymans 2013-03-22 12:16:45 +01:00
parent d09a72029c
commit 87041064f8

View file

@ -294,6 +294,13 @@ gst_fluidsynth_clip_buffer (GstFluidsynth * fluidsynth, GstBuffer * buffer)
} }
#endif #endif
static void
gst_fluidsynth_reset (GstFluidsynth * fluidsynth)
{
fluid_synth_system_reset (fluidsynth->synth);
fluidsynth->last_pts = GST_CLOCK_TIME_NONE;
}
static gboolean static gboolean
gst_fluidsynth_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) 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); fluidsynth->segment);
res = gst_pad_event_default (pad, parent, event); res = gst_pad_event_default (pad, parent, event);
break; break;
case GST_EVENT_FLUSH_STOP:
gst_fluidsynth_reset (fluidsynth);
res = gst_pad_event_default (pad, parent, event);
break;
case GST_EVENT_EOS: case GST_EVENT_EOS:
/* FIXME, push last samples */ /* FIXME, push last samples */
res = gst_pad_event_default (pad, parent, event); res = gst_pad_event_default (pad, parent, event);
@ -583,6 +594,7 @@ gst_fluidsynth_change_state (GstElement * element, GstStateChange transition)
goto open_failed; goto open_failed;
break; break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_fluidsynth_reset (fluidsynth);
break; break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;