mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-29 06:50:59 +00:00
textwrap: Don't panic on empty buffers
Simply don't calculate with any duration per word for this buffer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/990>
This commit is contained in:
parent
5bbe0eab25
commit
76eeaffbb2
1 changed files with 2 additions and 2 deletions
|
@ -176,8 +176,8 @@ impl TextWrap {
|
||||||
state.end_ts = None;
|
state.end_ts = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let duration_per_word: gst::ClockTime =
|
let num_words = data.split_whitespace().count() as u64;
|
||||||
duration / data.split_whitespace().count() as u64;
|
let duration_per_word = (num_words != 0).then(|| duration / num_words);
|
||||||
|
|
||||||
if state.start_ts.is_none() {
|
if state.start_ts.is_none() {
|
||||||
state.start_ts = buffer.pts();
|
state.start_ts = buffer.pts();
|
||||||
|
|
Loading…
Reference in a new issue