bmv3: do not demux empty video frames
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 2 Apr 2019 11:47:18 +0000 (13:47 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 2 Apr 2019 11:47:18 +0000 (13:47 +0200)
nihav-game/src/demuxers/bmv.rs

index 7553a94865b96b60479e744711c278a41f9919b2..ea06d7fe58f12d89ec2629ed0ed30c4836c86617 100644 (file)
@@ -193,6 +193,13 @@ impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> {
             } else {
                 asize = 0;
             }
+            if size == asize {
+                if self.pkt_buf.len() > 0 {
+                    return Ok(self.pkt_buf.pop().unwrap());
+                } else {
+                    continue;
+                }
+            }
             let mut buf: Vec<u8> = Vec::with_capacity(size - asize + 1);
             buf.resize(size - asize + 1, 0);
             buf[0] = ctype;