mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-27 14:08:18 +03:00
media-converter: Don't pad filler audio data
Fixes corrupt streams when dumping audio to disk. Relies on the client (e.g. FAudio) to fill in blank data when a buffer results in a short decode.
This commit is contained in:
parent
9845a94d1c
commit
905fc8ef44
@ -530,24 +530,7 @@ impl AudioConvState {
|
|||||||
|
|
||||||
let buf = Box::new(*include_bytes!("../blank.ptna"));
|
let buf = Box::new(*include_bytes!("../blank.ptna"));
|
||||||
|
|
||||||
/* calculate average expected length of this buffer */
|
Ok((buf, 0.0))
|
||||||
let codec_data = self.codec_data.as_ref().unwrap();
|
|
||||||
|
|
||||||
let mut repeat_count = if codec_data.bitrate > 0 {
|
|
||||||
let buffer_time_ms = (buf_len * 8 /* to bits */ * 1000 /* to ms */) as f32
|
|
||||||
/ (codec_data.bitrate as f32);
|
|
||||||
|
|
||||||
/* repeat the known-length blank file enough times to fill the expected length */
|
|
||||||
buffer_time_ms / BLANK_AUDIO_FILE_LENGTH_MS
|
|
||||||
} else {
|
|
||||||
/* invalid bitrate, so just play the file once */
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
/* scale to output rate */
|
|
||||||
repeat_count *= codec_data.rate as f32 / BLANK_AUDIO_FILE_RATE;
|
|
||||||
|
|
||||||
Ok((buf, repeat_count))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user