diff options
author | François Laignel <fengalin@free.fr> | 2020-05-25 18:34:40 +0300 |
---|---|---|
committer | François Laignel <fengalin@free.fr> | 2020-05-25 19:31:49 +0300 |
commit | 04f85f6dbd1ff95a0ee511e36989b24ab48fd284 (patch) | |
tree | 3070dbd6876ddc9c838b4e43373008f36b90d423 /generic | |
parent | 244f6dd6f7a015cb9a9ee3a18b6dc6f70e43b86a (diff) |
threadshare: return false when Flush{Start,Stop} fails
Diffstat (limited to 'generic')
-rw-r--r-- | generic/threadshare/src/jitterbuffer/jitterbuffer.rs | 36 | ||||
-rw-r--r-- | generic/threadshare/src/proxy.rs | 17 | ||||
-rw-r--r-- | generic/threadshare/src/queue.rs | 27 |
3 files changed, 69 insertions, 11 deletions
diff --git a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs index fb7c03d07..748cfe0a2 100644 --- a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs +++ b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs @@ -26,7 +26,7 @@ use glib::{glib_object_impl, glib_object_subclass}; use gst::prelude::*; use gst::subclass::prelude::*; -use gst::{gst_debug, gst_error, gst_error_msg, gst_info, gst_log, gst_trace}; +use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg, gst_info, gst_log, gst_trace}; use gst_rtp::RTPBuffer; use lazy_static::lazy_static; @@ -654,7 +654,7 @@ impl PadSinkHandler for SinkHandler { &self, pad: &PadSinkRef, jb: &JitterBuffer, - _element: &gst::Element, + element: &gst::Element, event: gst::Event, ) -> bool { use gst::EventView; @@ -664,6 +664,13 @@ impl PadSinkHandler for SinkHandler { if let EventView::FlushStart(..) = event.view() { if let Err(err) = jb.task.flush_start() { gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStart failed {:?}", err] + ); + return false; } } @@ -702,8 +709,14 @@ impl PadSinkHandler for SinkHandler { } EventView::FlushStop(..) => { if let Err(err) = jb.task.flush_stop() { - // FIXME we should probably return false if that one fails gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStop failed {:?}", err] + ); + return false; } } EventView::Eos(..) => { @@ -971,7 +984,7 @@ impl PadSrcHandler for SrcHandler { &self, pad: &PadSrcRef, jb: &JitterBuffer, - _element: &gst::Element, + element: &gst::Element, event: gst::Event, ) -> bool { use gst::EventView; @@ -982,12 +995,25 @@ impl PadSrcHandler for SrcHandler { EventView::FlushStart(..) => { if let Err(err) = jb.task.flush_start() { gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStart failed {:?}", err] + ); + return false; } } EventView::FlushStop(..) => { if let Err(err) = jb.task.flush_stop() { - // FIXME we should probably return false if that one fails gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStop failed {:?}", err] + ); + return false; } } _ => (), diff --git a/generic/threadshare/src/proxy.rs b/generic/threadshare/src/proxy.rs index 9f2fc4a68..6972b0080 100644 --- a/generic/threadshare/src/proxy.rs +++ b/generic/threadshare/src/proxy.rs @@ -806,7 +806,7 @@ impl PadSrcHandler for ProxySrcPadHandler { &self, pad: &PadSrcRef, proxysrc: &ProxySrc, - _element: &gst::Element, + element: &gst::Element, event: gst::Event, ) -> bool { use gst::EventView; @@ -828,12 +828,25 @@ impl PadSrcHandler for ProxySrcPadHandler { EventView::FlushStart(..) => { if let Err(err) = proxysrc.task.flush_start() { gst_error!(SRC_CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStart failed {:?}", err] + ); + return false; } } EventView::FlushStop(..) => { if let Err(err) = proxysrc.task.flush_stop() { - // FIXME we should probably return false if that one fails gst_error!(SRC_CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStop failed {:?}", err] + ); + return false; } } _ => (), diff --git a/generic/threadshare/src/queue.rs b/generic/threadshare/src/queue.rs index c8a9a2f89..021643351 100644 --- a/generic/threadshare/src/queue.rs +++ b/generic/threadshare/src/queue.rs @@ -185,7 +185,7 @@ impl PadSinkHandler for QueuePadSinkHandler { &self, pad: &PadSinkRef, queue: &Queue, - _element: &gst::Element, + element: &gst::Element, event: gst::Event, ) -> bool { use gst::EventView; @@ -195,6 +195,13 @@ impl PadSinkHandler for QueuePadSinkHandler { if let EventView::FlushStart(..) = event.view() { if let Err(err) = queue.task.flush_start() { gst_error!(CAT, obj: pad.gst_pad(), "FlushStart failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStart failed {:?}", err] + ); + return false; } } @@ -221,8 +228,14 @@ impl PadSinkHandler for QueuePadSinkHandler { if let EventView::FlushStop(..) = event.view() { if let Err(err) = queue.task.flush_stop() { - // FIXME we should probably return false if that one fails gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStop failed {:?}", err] + ); + return false; } } @@ -293,7 +306,7 @@ impl PadSrcHandler for QueuePadSrcHandler { &self, pad: &PadSrcRef, queue: &Queue, - _element: &gst::Element, + element: &gst::Element, event: gst::Event, ) -> bool { use gst::EventView; @@ -308,8 +321,14 @@ impl PadSrcHandler for QueuePadSrcHandler { } EventView::FlushStop(..) => { if let Err(err) = queue.task.flush_stop() { - // FIXME we should probably return false if that one fails gst_error!(CAT, obj: pad.gst_pad(), "FlushStop failed {:?}", err); + gst_element_error!( + element, + gst::StreamError::Failed, + ("Internal data stream error"), + ["FlushStop failed {:?}", err] + ); + return false; } } _ => (), |