From 4c6c19cb19126ed8c95f1077472e81991de8bb1c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 5 Sep 2018 13:59:24 +0200 Subject: [PATCH] frame: treat single-channel audio as planar too if possible --- src/frame.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); -- 2.39.5