]> git.sesse.net Git - vlc/commitdiff
FluidSynth: handle discontinuities
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 10 Jul 2014 17:34:53 +0000 (20:34 +0300)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 11 Jul 2014 07:43:30 +0000 (09:43 +0200)
modules/codec/fluidsynth.c

index fe065d67d7b7210651b4f5a4251deddd13605f4e..43a91f2af3a7e983614e6f3d1f7cf9a4b304c6b2 100644 (file)
@@ -206,6 +206,16 @@ static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
         return NULL;
     *pp_block = NULL;
 
+    if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED))
+    {
+        date_Set (&p_sys->end_date, 0);
+        //fluid_synth_system_reset (p_sys->synth);
+        fluid_synth_program_reset (p_sys->synth);
+        for (unsigned channel = 0; channel < 16; channel++)
+            for (unsigned note = 0; note < 128; note++)
+                fluid_synth_noteoff (p_sys->synth, channel, note);
+    }
+
     if (p_block->i_pts > VLC_TS_INVALID && !date_Get (&p_sys->end_date))
         date_Set (&p_sys->end_date, p_block->i_pts);
     else