let mut nal_buf = Vec::with_capacity(65536);
let mut is_eof = false;
+ let mut got_frame = !buf.is_empty();
while !is_eof {
match read_nal(&mut self.buf, &mut nal_buf, flush) {
Ok(()) => {},
break;
} else {
put_nal(&mut buf, &nal_buf);
+ got_frame = true;
}
},
- 9 if !buf.is_empty() => { break; },
+ 9 if got_frame || !buf.is_empty() => { break; },
+ 9 => {},
_ => {
//println!("non-slice NAL {} @ {:X}", nal_type, self.src.tell());
put_nal(&mut buf, &nal_buf);
}
}
- if is_eof && buf.is_empty() {
+ if is_eof && !got_frame {
return Ok(None);
}