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)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sat, 8 Feb 2014 16:05:05 +0000 (17:05 +0100)
Specifically, the crash at the end of playback was happening when end trim was
not being subtracted from i_buffer.

(cherry picked from commit f88f91467700484a65d6c5abf0a71cfc4a209320)
Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
modules/codec/opus.c

index d9d3257..51fa27c 100644 (file)
@@ -395,6 +395,10 @@ 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 )
     {
         memmove(p_aout_buffer->p_buffer,