fmp4: panic when flushing
The panic can easily be reproduced by modifying this example:
diff --git a/mux/fmp4/examples/hls_live.rs b/mux/fmp4/examples/hls_live.rs
index 77dce7f16..5a3f23599 100644
--- a/mux/fmp4/examples/hls_live.rs
+++ b/mux/fmp4/examples/hls_live.rs
@@ -539,6 +539,14 @@ fn main() -> Result<(), Error> {
pipeline.set_state(gst::State::Playing)?;
+ let pipeline_clone = pipeline.clone();
+ std::thread::spawn(move || {
+ std::thread::sleep(std::time::Duration::from_secs(5));
+ dbg!("flush");
+ pipeline_clone.send_event(gst::event::FlushStart::builder().build());
+ pipeline_clone.send_event(gst::event::FlushStop::builder(false).build());
+ });
+
let bus = pipeline
.bus()
.expect("Pipeline without bus. Shouldn't happen!");
It should trigger this assertion:
assertion failed: timeout || need_new_header || stream.sinkpad.is_eos() ||
stream.queued_gops.get(1).map(|gop| gop.final_earliest_pts) ==
Some(true) || settings.chunk_duration.is_some()
stack backtrace:
0: 0x5649bda5ab8a - std::backtrace_rs::backtrace::libunwind::trace::h99efb0985cae5d78
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x5649bda5ab8a - std::backtrace_rs::backtrace::trace_unsynchronized::he2c1aa63b3f7fad8
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5649bda5ab8a - std::sys::backtrace::_print_fmt::h8a221d40f5e0f88b
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/backtrace.rs:66:9
3: 0x5649bda5ab8a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h304520fd6a30aa07
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/backtrace.rs:39:26
4: 0x5649bda7d92b - core::fmt::rt::Argument::fmt::h5da9c218ec984eaf
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/fmt/rt.rs:177:76
5: 0x5649bda7d92b - core::fmt::write::hf5713710ce10ff22
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/fmt/mod.rs:1178:21
6: 0x5649bda57fc3 - std::io::Write::write_fmt::hda708db57927dacf
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/io/mod.rs:1823:15
7: 0x5649bda5bd32 - std::sys::backtrace::BacktraceLock::print::hbcdbec4d97c91528
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/backtrace.rs:42:9
8: 0x5649bda5bd32 - std::panicking::default_hook::{{closure}}::he1ad87607d0c11c5
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:266:22
9: 0x5649bda5b99e - std::panicking::default_hook::h81c8cd2e7c59ee33
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:293:9
10: 0x5649bda5c59f - std::panicking::rust_panic_with_hook::had2118629c312a4a
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:797:13
11: 0x5649bda5c2e3 - std::panicking::begin_panic_handler::{{closure}}::h7fa5985d111bafa2
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:664:13
12: 0x5649bda5b069 - std::sys::backtrace::__rust_end_short_backtrace::h704d151dbefa09c5
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/backtrace.rs:170:18
13: 0x5649bda5bfa4 - rust_begin_unwind
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
14: 0x5649bda7b8f3 - core::panicking::panic_fmt::h3eea515d05f7a35e
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:74:14
15: 0x5649bda7b97c - core::panicking::panic::h102d65dbfa674afe
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:148:5
16: 0x5649bd9a9eb9 - gstfmp4::fmp4mux::imp::FMP4Mux::drain_buffers_one_stream::h1bb1772ff588074d
at /var/home/cassidy/dev/rust/gst-plugins-rs/mux/fmp4/src/fmp4mux/imp.rs:1700:9
17: 0x5649bd9ab3d7 - gstfmp4::fmp4mux::imp::FMP4Mux::drain_buffers::h929c04a9d29a36e9
at /var/home/cassidy/dev/rust/gst-plugins-rs/mux/fmp4/src/fmp4mux/imp.rs:2248:24
18: 0x5649bd9ab3d7 - gstfmp4::fmp4mux::imp::FMP4Mux::drain_one_chunk::h16b58cf4d748fde8
at /var/home/cassidy/dev/rust/gst-plugins-rs/mux/fmp4/src/fmp4mux/imp.rs:2628:13
19: 0x5649bd9b7b8b - gstfmp4::fmp4mux::imp::FMP4Mux::drain::h36e777b974b56d86
at /var/home/cassidy/dev/rust/gst-plugins-rs/mux/fmp4/src/fmp4mux/imp.rs:2850:23
20: 0x5649bd9b7b8b - <gstfmp4::fmp4mux::imp::FMP4Mux as gstreamer_base::subclass::aggregator::AggregatorImpl>::aggregate::hcc4ab0d4409e369d
at /var/home/cassidy/dev/rust/gst-plugins-rs/mux/fmp4/src/fmp4mux/imp.rs:3885:23
21: 0x5649bd9ed840 - gstreamer_base::subclass::aggregator::aggregator_aggregate::{{closure}}::hfd175f9a49214350
at /var/home/cassidy/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/36eca7c/gstreamer-base/src/subclass/aggregator.rs:785:9
22: 0x5649bd9ed840 - core::ops::function::FnOnce::call_once::h4f3feb2a7440e2ba
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
23: 0x5649bd9ed840 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h3844d9555c1243a1
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panic/unwind_safe.rs:272:9
24: 0x5649bd9ed840 - std::panicking::try::do_call::h108a35554439bd42
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:554:40
25: 0x5649bd9ed840 - std::panicking::try::h1ca71ad5c928439b
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:518:19
26: 0x5649bd9ed840 - std::panic::catch_unwind::h5df6d7b1b9e42986
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panic.rs:345:14
27: 0x5649bd9ce076 - gstreamer_base::subclass::aggregator::aggregator_aggregate::h8ae046f5d965e7d2
at /var/home/cassidy/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/36eca7c/gstreamer-base/src/subclass/aggregator.rs:784:5
28: 0x5649bd982a23 - gstreamer_base::subclass::aggregator::AggregatorImplExt::parent_aggregate::h87f1476f6be05822
at /var/home/cassidy/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/36eca7c/gstreamer-base/src/subclass/aggregator.rs:341:27
29: 0x5649bd9f3a90 - gstreamer_base::subclass::aggregator::aggregator_aggregate::{{closure}}::h493db379b90715ea
at /var/home/cassidy/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/36eca7c/gstreamer-base/src/subclass/aggregator.rs:785:9
30: 0x5649bd9f3a90 - core::ops::function::FnOnce::call_once::h6f1edac23d9f7cae
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
31: 0x5649bd9f3a90 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2835baca62efbc27
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panic/unwind_safe.rs:272:9
32: 0x5649bd9f3a90 - std::panicking::try::do_call::h07bd574d93ac6c5d
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:554:40
33: 0x5649bd9f3a90 - std::panicking::try::hb5662e914c014ee5
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:518:19
34: 0x5649bd9f3a90 - std::panic::catch_unwind::hfd3edc252b8c73ac
at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panic.rs:345:14
35: 0x5649bd9cdca4 - gstreamer_base::subclass::aggregator::aggregator_aggregate::h2f68dfd9fac6ec01
at /var/home/cassidy/.cargo/git/checkouts/gstreamer-rs-79e52a2d27eb91a3/36eca7c/gstreamer-base/src/subclass/aggregator.rs:784:5
36: 0x7fbb52e566fa - gst_aggregator_loop
at /var/home/cassidy/dev/gst/gstreamer/build-f40/../subprojects/gstreamer/libs/gst/base/gstaggregator.c:1490:21
37: 0x7fbb52e566fa - gst_aggregator_aggregate_func
at /var/home/cassidy/dev/gst/gstreamer/build-f40/../subprojects/gstreamer/libs/gst/base/gstaggregator.c:1553:11
38: 0x7fbb52da3802 - gst_task_func
at /var/home/cassidy/dev/gst/gstreamer/build-f40/../subprojects/gstreamer/gst/gsttask.c:399:5
39: 0x7fbb52baa542 - <unknown>
40: 0x7fbb52ba8813 - <unknown>
41: 0x7fbb526c86d7 - start_thread
42: 0x7fbb5274c60c - __clone3
43: 0x0 - <unknown>