]> git.sesse.net Git - vlc/blobdiff - modules/audio_mixer/spdif.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / audio_mixer / spdif.c
index 4005f831b5bd8f3109cb263a4b3a6851054e1ff6..c21e6e6094c74f95b04f52a0a8c8620cf37a07fe 100644 (file)
@@ -29,6 +29,8 @@
 # include "config.h"
 #endif
 
+#include <assert.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
@@ -66,7 +68,7 @@ static int Create( vlc_object_t *p_this )
     p_mixer->mix = DoWork;
     /* This is a bit kludgy - do not ask for a new buffer, since the one
      * provided by the first input will be good enough. */
-    p_mixer->allocation.i_alloc_type = AOUT_ALLOC_NONE;
+    p_mixer->allocation.b_alloc = false;
 
     return 0;
 }
@@ -84,7 +86,11 @@ static void DoWork( aout_mixer_t * p_mixer, aout_buffer_t * p_buffer )
         p_input = p_mixer->input[++i];
 
     aout_buffer_t * p_old_buffer = aout_FifoPop( NULL, &p_input->fifo );
-    aout_BufferFree( p_old_buffer );
+    /* We don't free the old buffer because,
+     * The aout core use a hack to avoid useless memcpy: the buffer in which
+     * to mix is the same as the one in the first active input fifo.
+     * So the ownership of that buffer belongs to our caller */
+    assert( p_old_buffer == p_buffer );
 
     /* Empty other FIFOs to avoid a memory leak. */
     for ( i++; i < p_mixer->input_count; i++ )