mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-29 21:33:31 -05:00
fix panic when requesting zero segment duration
The recording::Segment was constructing a segment with no frames in it, which was causing a panic when appending a zero-length stts to the Slices. Fix this in a couple ways: * Slices::append should return Err rather than panic. No reason to crash the whole program when we have trouble serving a single .mp4 request. * recording::Segment shouldn't produce zero-frame segments
This commit is contained in:
@@ -1405,8 +1405,7 @@ impl BodyState {
|
||||
|
||||
fn append_slice(&mut self, len: u64, t: SliceType, p: usize) -> Result<(), Error> {
|
||||
let l = self.slices.len();
|
||||
self.slices.append(Slice::new(l + len, t, p)?);
|
||||
Ok(())
|
||||
self.slices.append(Slice::new(l + len, t, p)?)
|
||||
}
|
||||
|
||||
/// Appends a static bytestring, flushing the buffer if necessary.
|
||||
|
||||
Reference in New Issue
Block a user