Skip to content

Pad: allow pad probes to capture their environment as mutable

François Laignel requested to merge fengalin:master into master

Example use case:

    let mut is_done = AtomicBool::new(false);
    sink_pad.add_probe(gst::PadProbeType::BUFFER, move |_pad, probe_info| {
         let mut is_cndt_lck = is_cndt.get_mut();
         if !*is_done_lck {
             // Do stuff
             *is_done_lck = true;
         } else {
             // Do other stuff
         }
         ...
    }

I think this is valid because the function for add_probe is constrained to be Send + Sync. If we only allow for Fn functions, the inner condition must be a clone to an Arc<Mutex<bool>>.

Merge request reports