h263: fix timestamp difference calculcation
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 24 Feb 2018 17:07:16 +0000 (18:07 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 24 Feb 2018 17:35:30 +0000 (18:35 +0100)
src/codecs/h263/decoder.rs

index 85d9eeaa5cbe510935c4273571b8ee710e45f30a..a7768ea4c18999aba8ff6bb19e11e3006fdc5018 100644 (file)
@@ -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 };