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:
Scott Lamb
2017-10-17 08:55:21 -07:00
parent 1d08698d0c
commit 9041eeb907
3 changed files with 31 additions and 12 deletions

View File

@@ -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.