mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-19 15:46:00 +00:00
cdg: Fix assertion failure while typefinding with too short file
thread '<unnamed>' panicked at 'assertion failed: step != 0', ... Don't iterate with zero step size.
This commit is contained in:
parent
5cba2b002b
commit
6559287bea
1 changed files with 5 additions and 0 deletions
|
@ -60,6 +60,11 @@ fn compute_probability(typefind: &mut TypeFind) -> TypeFindProbability {
|
|||
.unwrap_or(TYPEFIND_SEARCH_WINDOW as u64 * NB_WINDOWS);
|
||||
let step = len / NB_WINDOWS;
|
||||
|
||||
// Too short file
|
||||
if step == 0 {
|
||||
return TypeFindProbability::None;
|
||||
}
|
||||
|
||||
for offset in (0..len).step_by(step as usize) {
|
||||
let proba = match cdg_packets_ratio(typefind, offset as i64, TYPEFIND_SEARCH_WINDOW) {
|
||||
0..=5 => TypeFindProbability::None,
|
||||
|
|
Loading…
Reference in a new issue