livesync: Support variable framerate in fallback buffer duration calc

Avoids a divide by zero error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1123>
This commit is contained in:
Talha Khan 2023-03-09 22:11:33 +08:00 committed by GStreamer Marge Bot
parent 9a50f1f318
commit a12a8c566d

View file

@ -482,6 +482,7 @@ impl State {
.and_then(|c| c.structure(0)) .and_then(|c| c.structure(0))
.filter(|s| s.name().starts_with("video/")) .filter(|s| s.name().starts_with("video/"))
.and_then(|s| s.get::<gst::Fraction>("framerate").ok()) .and_then(|s| s.get::<gst::Fraction>("framerate").ok())
.filter(|framerate| framerate.denom() > 0 && framerate.numer() > 0)
.and_then(|framerate| { .and_then(|framerate| {
gst::ClockTime::SECOND gst::ClockTime::SECOND
.mul_div_round(framerate.denom() as u64, framerate.numer() as u64) .mul_div_round(framerate.denom() as u64, framerate.numer() as u64)