fix re-skipping already skipped header

This commit is contained in:
Muaz Ahmad 2023-10-06 12:44:30 +05:00
parent a27ecba29b
commit 64bcb35c49

View file

@ -40,7 +40,7 @@ impl FLVReader {
fn skip_init_header(&mut self) -> Result<(), Box<dyn Error>> { fn skip_init_header(&mut self) -> Result<(), Box<dyn Error>> {
let mut rest_of_header = [0u8; 5]; let mut rest_of_header = [0u8; 5];
self.stdin.read_exact(&mut rest_of_header)?; self.stdin.read_exact(&mut rest_of_header)?;
let head_offset = u32::from_be_bytes(rest_of_header[1..].try_into()?) as usize + 4; let head_offset = u32::from_be_bytes(rest_of_header[1..].try_into()?) as usize - 9 + 4;
let mut skip_header_extra = vec![0u8; head_offset]; let mut skip_header_extra = vec![0u8; head_offset];
self.stdin.read_exact(skip_header_extra.as_mut_slice())?; self.stdin.read_exact(skip_header_extra.as_mut_slice())?;
return Ok(()); return Ok(());