From: Kostya Shishkov Date: Sat, 24 Feb 2018 17:07:16 +0000 (+0100) Subject: h263: fix timestamp difference calculcation X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=88e9abd4b69419cfa83093a1e4aee3066b90bcea;p=nihav.git h263: fix timestamp difference calculcation --- diff --git a/src/codecs/h263/decoder.rs b/src/codecs/h263/decoder.rs index 85d9eea..a7768ea 100644 --- a/src/codecs/h263/decoder.rs +++ b/src/codecs/h263/decoder.rs @@ -208,7 +208,8 @@ impl H263BaseDecoder { } let is_b = pinfo.mode == Type::B; - let tsdiff = pinfo.ts.wrapping_sub(self.last_ts) >> 1; + let tsdiff = if pinfo.is_pb() { pinfo.ts.wrapping_sub(self.last_ts) >> 1 } + else { self.last_ts.wrapping_sub(self.next_ts) >> 1 }; let bsdiff = if pinfo.is_pb() { (pinfo.get_pbinfo().get_trb() as u16) << 7 } else { pinfo.ts.wrapping_sub(self.next_ts) >> 1 };