mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-26 07:05:56 -05:00
be robust to crazy timestamps in ffmpeg streams
This commit is contained in:
parent
cdbcad6c80
commit
6f2b66c406
@ -542,7 +542,12 @@ impl<'a> Writer<'a> {
|
||||
is_key: bool) -> Result<(), Error> {
|
||||
let w = self.0.as_mut().unwrap();
|
||||
if let Some(unflushed) = w.unflushed_sample.take() {
|
||||
let duration = w.adjuster.adjust((pts_90k - unflushed.pts_90k) as i32);
|
||||
let duration = (pts_90k - unflushed.pts_90k) as i32;
|
||||
if duration <= 0 {
|
||||
return Err(Error::new(format!("pts not monotonically increasing; got {} then {}",
|
||||
unflushed.pts_90k, pts_90k)));
|
||||
}
|
||||
let duration = w.adjuster.adjust(duration);
|
||||
w.index.add_sample(duration, unflushed.len, unflushed.is_key);
|
||||
w.extend_local_start(unflushed.local_time);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user