mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-13 04:35:24 +00:00
fallbackswitch: Fix buffer clipping if no duration and 0/1 framerate
Instead of a division by 0, simply ignore the duration for clipping purposes.
This commit is contained in:
parent
e7053bc046
commit
7d88c014f8
1 changed files with 13 additions and 7 deletions
|
@ -673,12 +673,16 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
} else if let Some(ref video_info) = pad_state.video_info {
|
} else if let Some(ref video_info) = pad_state.video_info {
|
||||||
|
if *video_info.fps().numer() > 0 {
|
||||||
gst::SECOND
|
gst::SECOND
|
||||||
.mul_div_floor(
|
.mul_div_floor(
|
||||||
*video_info.fps().denom() as u64,
|
*video_info.fps().denom() as u64,
|
||||||
*video_info.fps().numer() as u64,
|
*video_info.fps().numer() as u64,
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
} else {
|
||||||
|
gst::CLOCK_TIME_NONE
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
|
@ -704,8 +708,10 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
let buffer = buffer.make_mut();
|
let buffer = buffer.make_mut();
|
||||||
buffer.set_pts(start);
|
buffer.set_pts(start);
|
||||||
buffer.set_dts(start);
|
buffer.set_dts(start);
|
||||||
|
if duration.is_some() {
|
||||||
buffer.set_duration(stop - start);
|
buffer.set_duration(stop - start);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buffer
|
buffer
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue