shithub: sox

Download patch

ref: 75996eeb9ee97754212d9f507d81f587d7fc01d9
parent: 1d48e533e1c6de212ad1520ed6481b222727e7a6
author: Mans Rullgard <mans@mansr.com>
date: Mon Aug 3 10:13:33 EDT 2020

gsrt: pad to even sample count with silence [bug #312]

The sample value for silence depends on the encoding.  Use the
appropriate value for the encoding in use rather than a literal
zero byte.

--- a/src/gsrt.c
+++ b/src/gsrt.c
@@ -157,8 +157,10 @@
 {
   long num_samples = ft->tell_off - HEADER_SIZE;
 
-  if (num_samples & 1)
-    lsx_writeb(ft, 0);
+  if (num_samples & 1) {
+    sox_sample_t pad = 0;
+    lsx_rawwrite(ft, &pad, 1);
+  }
 
   if (ft->seekable) {
     unsigned i, file_size = ft->tell_off >> 1;