From: Kostya Shishkov Date: Fri, 21 Mar 2025 13:30:42 +0000 (+0100) Subject: msadpcmenc: set proper block size if it can be calculated from timebase X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=4d6c38526bdf203cdda0fef386d7e78ff724fbdf;p=nihav.git msadpcmenc: set proper block size if it can be calculated from timebase --- 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; }