]> git.nihav.org Git - nihav-encoder.git/commitdiff
make audio converter output some samples if the output format does not care
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 7 Apr 2025 16:42:08 +0000 (18:42 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 7 Apr 2025 16:42:08 +0000 (18:42 +0200)
Otherwise it would go into infinite loop outputting zero samples.

src/acvt.rs

index 254bed692c0056371bc116b7c31da08b307832eb..903c8cfe80703a041cebb04b1b69b552adf3b624 100644 (file)
@@ -176,9 +176,13 @@ impl AudioConverter {
             };
         const RESAMPLE_FILTER_ORDER: usize = 16;
         let resampler = NAResample::new(sinfo.sample_rate, dinfo, &dst_chmap, RESAMPLE_FILTER_ORDER);
+        let mut dst_fmt = *dinfo;
+        if dst_fmt.block_len == 0 {
+            dst_fmt.block_len = 256;
+        }
         Self {
             queue,
-            dst_fmt:    *dinfo,
+            dst_fmt,
             dst_chmap,
             apts:       None,
             resampler,