]> git.sesse.net Git - vlc/commitdiff
opus: always sync i_buffer with i_nb_samples (fixes #10135)
authorTristan Matthews <le.businessman@gmail.com>
Thu, 9 Jan 2014 06:28:47 +0000 (01:28 -0500)
committerTristan Matthews <le.businessman@gmail.com>
Thu, 9 Jan 2014 06:32:49 +0000 (01:32 -0500)
Specifically, the crash at the end of playback was happening when end trim was
not being subtracted from i_buffer.

modules/codec/opus.c

index 32c0165d2d1a203985acd3927e160006ce2e85a9..8aa8adb42b47199310d7d6d21b9eee96444a580e 100644 (file)
@@ -408,10 +408,12 @@ static block_t *DecodePacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
             msg_Err( p_dec, "Error: corrupted stream?" );
         return NULL;
     }
+
+    p_aout_buffer->i_buffer = (i_nb_samples - i_end_trim) *
+                              p_sys->header.channels * sizeof(float);
+
     if( spp > i_nb_samples )
     {
-        p_aout_buffer->i_buffer = (i_nb_samples - i_end_trim) *
-                                  p_sys->header.channels * sizeof(float);
         memmove(p_aout_buffer->p_buffer,
             p_aout_buffer->p_buffer
             + (spp - i_nb_samples)*p_sys->header.channels*sizeof(float),