media-converter: Remove audio data repeat logic

This commit is contained in:
Andrew Eikum 2021-10-13 11:37:58 -05:00 committed by Arkadiusz Hiler
parent 905fc8ef44
commit ac2caa3e54

View file

@ -484,7 +484,7 @@ impl AudioConvState {
self.loop_hash_state.reset();
}
fn open_transcode_file(&mut self, buffer: gst::Buffer) -> io::Result<(Box<[u8]>, f32)> {
fn open_transcode_file(&mut self, buffer: gst::Buffer) -> io::Result<Box<[u8]>> {
let mapped = buffer.into_mapped_buffer_readable().unwrap();
let buf_len = mapped.get_size();
@ -511,7 +511,7 @@ impl AudioConvState {
/* success */
let mut buf = vec![0u8; transcoded_size].into_boxed_slice();
if read_fozdb.read_entry(AUDIOCONV_FOZ_TAG_PTNADATA, hash, 0, &mut buf, fossilize::CRCCheck::WithoutCRC).is_ok() {
return Ok((buf, 0.0));
return Ok(buf);
}
}
if try_loop {
@ -519,7 +519,7 @@ impl AudioConvState {
/* success */
let mut buf = vec![0u8; transcoded_size].into_boxed_slice();
if read_fozdb.read_entry(AUDIOCONV_FOZ_TAG_PTNADATA, loop_hash, 0, &mut buf, fossilize::CRCCheck::WithoutCRC).is_ok() {
return Ok((buf, 0.0));
return Ok(buf);
}
}
}
@ -530,7 +530,7 @@ impl AudioConvState {
let buf = Box::new(*include_bytes!("../blank.ptna"));
Ok((buf, 0.0))
Ok(buf)
}
}
@ -701,7 +701,7 @@ impl AudioConv {
None => { return Err(gst::FlowError::Error); },
};
let (ptnadata, mut repeat_count) = state.open_transcode_file(buffer).map_err(|_| {
let ptnadata = state.open_transcode_file(buffer).map_err(|_| {
gst_error!(CAT, "ERROR! Failed to read transcoded audio! Things will go badly..."); gst::FlowError::Error
})?;
@ -709,14 +709,7 @@ impl AudioConv {
loop {
if offs >= ptnadata.len() {
if repeat_count > 0.0 {
/* TODO: we're sending the whole partial packet. we could set padding instead */
repeat_count -= 1.0;
offs = 0;
continue;
} else {
break;
}
break;
}
if offs + 4 >= ptnadata.len() {