]> granicus.if.org Git - handbrake/commitdiff
sync: fix size of silence buffer
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 12 Jul 2017 20:38:00 +0000 (13:38 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 12 Jul 2017 20:38:00 +0000 (13:38 -0700)
It was not an even number of sample size * num channels in some cases

libhb/sync.c

index 7b94712150b9c178ba87f258b4c87d269598624e..72b779bde8d3a39d1cfb114579c99e58c52ce92c 100644 (file)
@@ -318,10 +318,11 @@ static hb_buffer_t * CreateSilenceBuf( sync_stream_t * stream,
     }
     if (duration > 0)
     {
-        size = sizeof(float) *
-               (duration * stream->audio.audio->config.in.samplerate / 90000) *
-                   av_get_channel_layout_nb_channels(
-                              stream->audio.audio->config.in.channel_layout );
+        // Make certain size is even multiple of sample size * num channels
+        size = (int)(duration * stream->audio.audio->config.in.samplerate /
+                     90000) * sizeof(float) *
+               av_get_channel_layout_nb_channels(
+                              stream->audio.audio->config.in.channel_layout);
         if (size > 0)
         {
             buf = hb_buffer_init(size);