mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 21:11:00 +00:00
livesync: Extract LiveSync::flow_error
And add details so it behaves more like the `GST_ELEMENT_FLOW_ERROR` macro. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1083>
This commit is contained in:
parent
f03ee95bf0
commit
0af7151ae9
1 changed files with 16 additions and 13 deletions
|
@ -624,13 +624,7 @@ impl LiveSync {
|
||||||
|
|
||||||
if let Err(err) = state.srcresult {
|
if let Err(err) = state.srcresult {
|
||||||
if matches!(err, gst::FlowError::Flushing | gst::FlowError::Eos) {
|
if matches!(err, gst::FlowError::Flushing | gst::FlowError::Eos) {
|
||||||
let err = state.srcresult.unwrap_err();
|
self.flow_error(err);
|
||||||
gst::element_imp_error!(
|
|
||||||
self,
|
|
||||||
gst::StreamError::Failed,
|
|
||||||
("Internal data flow error."),
|
|
||||||
["streaming task paused, reason {} ({:?})", err, err]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,12 +946,7 @@ impl LiveSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
if eos && !matches!(err, gst::FlowError::Flushing | gst::FlowError::Eos) {
|
if eos && !matches!(err, gst::FlowError::Flushing | gst::FlowError::Eos) {
|
||||||
gst::element_imp_error!(
|
self.flow_error(err);
|
||||||
self,
|
|
||||||
gst::StreamError::Failed,
|
|
||||||
("Internal data flow error."),
|
|
||||||
["streaming task paused, reason {} ({:?})", err, err]
|
|
||||||
);
|
|
||||||
pad.push_event(gst::event::Eos::new());
|
pad.push_event(gst::event::Eos::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,4 +1228,18 @@ impl LiveSync {
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Produces a message like GST_ELEMENT_FLOW_ERROR does
|
||||||
|
fn flow_error(&self, err: gst::FlowError) {
|
||||||
|
let details = gst::Structure::builder("details")
|
||||||
|
.field("flow-return", err.into_glib())
|
||||||
|
.build();
|
||||||
|
gst::element_imp_error!(
|
||||||
|
self,
|
||||||
|
gst::StreamError::Failed,
|
||||||
|
("Internal data flow error."),
|
||||||
|
["streaming task paused, reason {} ({:?})", err, err],
|
||||||
|
details: details
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue