From 4d6c38526bdf203cdda0fef386d7e78ff724fbdf Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 21 Mar 2025 14:30:42 +0100 Subject: [PATCH] msadpcmenc: set proper block size if it can be calculated from timebase --- nihav-ms/src/codecs/msadpcm.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nihav-ms/src/codecs/msadpcm.rs b/nihav-ms/src/codecs/msadpcm.rs index 7896614..ef1fd96 100644 --- a/nihav-ms/src/codecs/msadpcm.rs +++ b/nihav-ms/src/codecs/msadpcm.rs @@ -323,6 +323,9 @@ impl NAEncoder for MSADPCMEncoder { if outinfo.block_len == 0 { outinfo.block_len = DEFAULT_BLOCK_LEN; } + if outinfo.block_len == 1 && encinfo.tb_den != outinfo.sample_rate { + outinfo.block_len = ((u64::from(outinfo.sample_rate) * u64::from(encinfo.tb_num) / u64::from(encinfo.tb_den) + 3) & !3) as usize; + } if outinfo.block_len < 2 { outinfo.block_len = 2; } -- 2.39.5