X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=src%2Fframe.rs;h=4aaf27251b2be497e43bcbada9f996648b07ade4;hb=b7b96b4cabbde72f05d0464299bf7fdf74d6480c;hp=6f22dafc1cdcdc4277704789ad3fbed197f00249;hpb=dd1b60e11adcb191557729e0cccd8f7ab0196fe5;p=nihav.git diff --git a/src/frame.rs b/src/frame.rs index 6f22daf..4aaf272 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(); @@ -374,7 +374,7 @@ pub fn alloc_audio_buffer(ainfo: NAAudioInfo, nsamples: usize, chmap: NAChannelM let mut data: Vec = Vec::with_capacity(length); data.resize(length, 0); let buf: NAAudioBuffer = NAAudioBuffer { data: Rc::new(RefCell::new(data)), info: ainfo, offs: offs, chmap: chmap, len: nsamples }; - Ok(NABufferType::AudioPacked(buf)) + Ok(NABufferType::AudioPacked(buf)) } }