diff --git a/gst-plugin-flv/src/flvdemux.rs b/gst-plugin-flv/src/flvdemux.rs index e6dfdbba..e9c59c3c 100644 --- a/gst-plugin-flv/src/flvdemux.rs +++ b/gst-plugin-flv/src/flvdemux.rs @@ -142,7 +142,7 @@ impl ObjectSubclass for FlvDemux { sinkpad.set_activate_function(|pad, parent| { FlvDemux::catch_panic_pad_function( parent, - || false, + || Err(glib_bool_error!("Panic activating sink pad")), |demux, element| demux.sink_activate(pad, element), ) }); @@ -150,7 +150,7 @@ impl ObjectSubclass for FlvDemux { sinkpad.set_activatemode_function(|pad, parent, mode, active| { FlvDemux::catch_panic_pad_function( parent, - || false, + || Err(glib_bool_error!("Panic activating sink pad with mode")), |demux, element| demux.sink_activatemode(pad, element, mode, active), ) }); @@ -286,11 +286,15 @@ impl ObjectImpl for FlvDemux { impl ElementImpl for FlvDemux {} impl FlvDemux { - fn sink_activate(&self, pad: &gst::Pad, _element: &gst::Element) -> bool { + fn sink_activate( + &self, + pad: &gst::Pad, + _element: &gst::Element, + ) -> Result<(), glib::BoolError> { let mode = { let mut query = gst::Query::new_scheduling(); if !pad.peer_query(&mut query) { - return false; + return Err(glib_bool_error!("Scheduling query failed on peer")); } // TODO: pull mode @@ -308,7 +312,7 @@ impl FlvDemux { } }; - pad.activate_mode(mode, true).is_ok() + pad.activate_mode(mode, true) } fn sink_activatemode( @@ -317,32 +321,30 @@ impl FlvDemux { element: &gst::Element, mode: gst::PadMode, active: bool, - ) -> bool { + ) -> Result<(), glib::BoolError> { if active { - if let Err(err) = self.start(element, mode) { + self.start(element, mode).map_err(|err| { element.post_error_message(&err); - return false; - } + glib_bool_error!("Failed to start element with mode {:?}", mode) + })?; if mode == gst::PadMode::Pull { // TODO implement pull mode // self.sinkpad.start_task(...) unimplemented!(); } - - true } else { if mode == gst::PadMode::Pull { let _ = self.sinkpad.stop_task(); } - if let Err(err) = self.stop(element) { + self.stop(element).map_err(|err| { element.post_error_message(&err); - return false; - } - - true + glib_bool_error!("Failed to stop element") + })?; } + + Ok(()) } fn start(&self, _element: &gst::Element, _mode: gst::PadMode) -> Result<(), gst::ErrorMessage> { diff --git a/gst-plugin-threadshare/tests/appsrc.rs b/gst-plugin-threadshare/tests/appsrc.rs index 91b15105..4d084095 100644 --- a/gst-plugin-threadshare/tests/appsrc.rs +++ b/gst-plugin-threadshare/tests/appsrc.rs @@ -29,7 +29,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gstthreadshare::plugin_register_static(); + gstthreadshare::plugin_register_static().expect("gstthreadshare appsrc test"); }); } diff --git a/gst-plugin-threadshare/tests/proxy.rs b/gst-plugin-threadshare/tests/proxy.rs index 4cc88cea..17e5ec0c 100644 --- a/gst-plugin-threadshare/tests/proxy.rs +++ b/gst-plugin-threadshare/tests/proxy.rs @@ -33,7 +33,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gstthreadshare::plugin_register_static(); + gstthreadshare::plugin_register_static().expect("gstthreadshare proxy test"); }); } diff --git a/gst-plugin-threadshare/tests/queue.rs b/gst-plugin-threadshare/tests/queue.rs index 5046f1a2..4428cabf 100644 --- a/gst-plugin-threadshare/tests/queue.rs +++ b/gst-plugin-threadshare/tests/queue.rs @@ -33,7 +33,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gstthreadshare::plugin_register_static(); + gstthreadshare::plugin_register_static().expect("gstthreadshare queue test"); }); } diff --git a/gst-plugin-threadshare/tests/tcpclientsrc.rs b/gst-plugin-threadshare/tests/tcpclientsrc.rs index ab3bcb68..63591e21 100644 --- a/gst-plugin-threadshare/tests/tcpclientsrc.rs +++ b/gst-plugin-threadshare/tests/tcpclientsrc.rs @@ -36,7 +36,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gstthreadshare::plugin_register_static(); + gstthreadshare::plugin_register_static().expect("gstthreadshare tcpclientsrc test"); }); } diff --git a/gst-plugin-threadshare/tests/udpsrc.rs b/gst-plugin-threadshare/tests/udpsrc.rs index 2ccdd84b..a6bbb02c 100644 --- a/gst-plugin-threadshare/tests/udpsrc.rs +++ b/gst-plugin-threadshare/tests/udpsrc.rs @@ -33,7 +33,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gstthreadshare::plugin_register_static(); + gstthreadshare::plugin_register_static().expect("gstthreadshare udpsrc test"); }); } diff --git a/gst-plugin-togglerecord/src/togglerecord.rs b/gst-plugin-togglerecord/src/togglerecord.rs index 70aff3cf..12a754bc 100644 --- a/gst-plugin-togglerecord/src/togglerecord.rs +++ b/gst-plugin-togglerecord/src/togglerecord.rs @@ -753,8 +753,10 @@ impl ToggleRecord { state.out_segment = state.in_segment.clone(); let offset = rec_state.running_time_offset.unwrap_or(0); - let res = state.out_segment.offset_running_time(-(offset as i64)); - assert!(res); + state + .out_segment + .offset_running_time(-(offset as i64)) + .expect("Adjusting record duration"); events.push( gst::Event::new_segment(&state.out_segment) .seqnum(state.segment_seqnum) diff --git a/gst-plugin-togglerecord/tests/tests.rs b/gst-plugin-togglerecord/tests/tests.rs index f60e417b..465fd2a8 100644 --- a/gst-plugin-togglerecord/tests/tests.rs +++ b/gst-plugin-togglerecord/tests/tests.rs @@ -35,7 +35,7 @@ fn init() { INIT.call_once(|| { gst::init().unwrap(); - gsttogglerecord::plugin_register_static(); + gsttogglerecord::plugin_register_static().expect("gsttogglerecord tests"); }); }