[vlc-commits] opus: always sync i_buffer with i_nb_samples (fixes #10135)

Tristan Matthews git at videolan.org
Thu Jan 9 07:35:53 CET 2014


vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Thu Jan  9 01:28:47 2014 -0500| [f88f91467700484a65d6c5abf0a71cfc4a209320] | committer: Tristan Matthews

opus: always sync i_buffer with i_nb_samples (fixes #10135)

Specifically, the crash at the end of playback was happening when end trim was
not being subtracted from i_buffer.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f88f91467700484a65d6c5abf0a71cfc4a209320
---

 modules/codec/opus.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index 32c0165..8aa8adb 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -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),



More information about the vlc-commits mailing list