aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2022-11-05 11:03:31 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2022-11-05 11:03:31 +0100
commit2a998d8fb46273ffbf62a7e909ad8228c089f1d0 (patch)
treef854d4e9e28232e181bdb2d2b0b78feeac42f098
parent63fcd784c5e808399f40166f1fe5bc494f24368b (diff)
downloadnihav-2a998d8fb46273ffbf62a7e909ad8228c089f1d0.tar.gz
core/frame: set correct duration for newly constructed audio buffer
-rw-r--r--nihav-core/src/frame.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs
index c93a921..792bfb4 100644
--- a/nihav-core/src/frame.rs
+++ b/nihav-core/src/frame.rs
@@ -271,7 +271,8 @@ impl<T: Clone> NAAudioBuffer<T> {
impl NAAudioBuffer<u8> {
/// Constructs a new `NAAudioBuffer` instance.
pub fn new_from_buf(info: NAAudioInfo, data: NABufferRef<Vec<u8>>, chmap: NAChannelMap) -> Self {
- let len = data.len();
+ let len = data.len() * 8 / chmap.num_channels() / (info.format.bits as usize);
+
NAAudioBuffer { info, data, chmap, offs: Vec::new(), len, stride: 0, step: 0 }
}
}