mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 21:05:15 +00:00
tutorial/progressbin: Handle streams without duration correctly
The "percent-double" field in the message from the progressreport element only exists if the overall duration of the stream is known.
This commit is contained in:
parent
0eab103066
commit
486e0e3420
1 changed files with 3 additions and 5 deletions
|
@ -156,11 +156,9 @@ impl BinImpl for ProgressBin {
|
|||
.unwrap_or(false) =>
|
||||
{
|
||||
let s = msg.get_structure().unwrap();
|
||||
let percent = s
|
||||
.get_some::<f64>("percent-double")
|
||||
.expect("ProgressBin::handle_message");
|
||||
|
||||
println!("progress: {:5.1}%", percent);
|
||||
if let Ok(percent) = s.get_some::<f64>("percent-double") {
|
||||
println!("progress: {:5.1}%", percent);
|
||||
}
|
||||
}
|
||||
_ => self.parent_handle_message(bin, msg),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue