From: Kostya Shishkov Date: Wed, 5 Sep 2018 11:59:24 +0000 (+0200) Subject: frame: treat single-channel audio as planar too if possible X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=4c6c19cb19126ed8c95f1077472e81991de8bb1c;hp=c19ce782830be53272ad3bade03d975fe377c8d0;p=nihav.git frame: treat single-channel audio as planar too if possible --- diff --git a/src/frame.rs b/src/frame.rs index 6f22daf..628efb6 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -336,7 +336,7 @@ pub fn alloc_video_buffer(vinfo: NAVideoInfo, align: u8) -> Result Result { let mut offs: Vec = Vec::new(); - if ainfo.format.is_planar() { + if ainfo.format.is_planar() || (ainfo.channels == 1 && (ainfo.format.get_bits() % 8) == 0) { let len = nsamples.checked_mul(ainfo.channels as usize); if len == None { return Err(AllocatorError::TooLargeDimensions); } let length = len.unwrap();