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:
Sebastian Dröge 2019-09-11 22:04:46 +03:00
parent e7053bc046
commit 7d88c014f8

View file

@ -673,12 +673,16 @@ impl AggregatorImpl for FallbackSwitch {
)
.unwrap()
} else if let Some(ref video_info) = pad_state.video_info {
gst::SECOND
.mul_div_floor(
*video_info.fps().denom() as u64,
*video_info.fps().numer() as u64,
)
.unwrap()
if *video_info.fps().numer() > 0 {
gst::SECOND
.mul_div_floor(
*video_info.fps().denom() as u64,
*video_info.fps().numer() as u64,
)
.unwrap()
} else {
gst::CLOCK_TIME_NONE
}
} else {
unreachable!()
};
@ -704,7 +708,9 @@ impl AggregatorImpl for FallbackSwitch {
let buffer = buffer.make_mut();
buffer.set_pts(start);
buffer.set_dts(start);
buffer.set_duration(stop - start);
if duration.is_some() {
buffer.set_duration(stop - start);
}
}
buffer