X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-realmedia%2Fsrc%2Fcodecs%2Frv3040.rs;h=d19e3fe5c520805d8ae760e84da98ec7b78b7b4d;hb=59dc9182c5eb3495cacf92b010c373b4eb37c2f9;hp=dde0b04774ae413c54ae6b0949228e2b5a60e405;hpb=1fdbd53e295c3876df7602cc5c5397730711ed24;p=nihav.git diff --git a/nihav-realmedia/src/codecs/rv3040.rs b/nihav-realmedia/src/codecs/rv3040.rs index dde0b04..d19e3fe 100644 --- a/nihav-realmedia/src/codecs/rv3040.rs +++ b/nihav-realmedia/src/codecs/rv3040.rs @@ -1106,6 +1106,22 @@ impl RV34Decoder { self.base_ts += 1 << 13; } } + match hdr0.ftype { + FrameType::P => { + if self.ipbs.get_lastref().is_none() { + return Err(DecoderError::MissingReference); + } + }, + FrameType::B => { + if self.ipbs.get_lastref().is_none() { + return Err(DecoderError::MissingReference); + } + if self.ipbs.get_nextref().is_none() { + return Err(DecoderError::MissingReference); + } + }, + _ => {}, + }; let ts_diff = (self.next_ts << 3).wrapping_sub(hdr0.pts << 3) >> 3; let ts = self.base_ts + (self.next_ts as u64) - (ts_diff as u64); sstate.trd = (self.next_ts << 3).wrapping_sub(self.last_ts << 3) >> 3; @@ -1250,4 +1266,7 @@ impl RV34Decoder { Ok((NABufferType::Video(buf), hdr0.ftype, ts)) } + pub fn flush(&mut self) { + self.ipbs.clear(); + } }