diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2018-09-05 13:59:24 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2018-09-05 13:59:24 +0200 |
commit | 4c6c19cb19126ed8c95f1077472e81991de8bb1c (patch) | |
tree | 532dae41c9b12e487dbbb1c9848f29d90fc98acf /src | |
parent | c19ce782830be53272ad3bade03d975fe377c8d0 (diff) | |
download | nihav-4c6c19cb19126ed8c95f1077472e81991de8bb1c.tar.gz |
frame: treat single-channel audio as planar too if possible
Diffstat (limited to 'src')
-rw-r--r-- | src/frame.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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<NABufferType, pub fn alloc_audio_buffer(ainfo: NAAudioInfo, nsamples: usize, chmap: NAChannelMap) -> Result<NABufferType, AllocatorError> { let mut offs: Vec<usize> = 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(); |