mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-08 18:25:30 +00:00
uriplaylistbin: replace errored with Status enum
This commit is contained in:
parent
2eb4a82093
commit
e3e4a109f9
1 changed files with 22 additions and 6 deletions
|
@ -101,6 +101,23 @@ impl Default for Settings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Status {
|
||||||
|
/// all good element is working
|
||||||
|
Running,
|
||||||
|
/// the element stopped because of an error
|
||||||
|
Error,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Status {
|
||||||
|
/// check if the element should stop proceeding
|
||||||
|
fn done(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Status::Running => false,
|
||||||
|
Status::Error => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
streamsynchronizer: gst::Element,
|
streamsynchronizer: gst::Element,
|
||||||
concat_audio: Vec<gst::Element>,
|
concat_audio: Vec<gst::Element>,
|
||||||
|
@ -111,8 +128,7 @@ struct State {
|
||||||
|
|
||||||
/// the current number of streams handled by the element
|
/// the current number of streams handled by the element
|
||||||
streams_topology: StreamsTopology,
|
streams_topology: StreamsTopology,
|
||||||
// true if the element stopped because of an error
|
status: Status,
|
||||||
errored: bool,
|
|
||||||
|
|
||||||
// we have max one item in one of each of those states
|
// we have max one item in one of each of those states
|
||||||
waiting_for_stream_collection: Option<Item>,
|
waiting_for_stream_collection: Option<Item>,
|
||||||
|
@ -138,7 +154,7 @@ impl State {
|
||||||
streamsynchronizer,
|
streamsynchronizer,
|
||||||
playlist: Playlist::new(uris, iterations),
|
playlist: Playlist::new(uris, iterations),
|
||||||
streams_topology: StreamsTopology::default(),
|
streams_topology: StreamsTopology::default(),
|
||||||
errored: false,
|
status: Status::Running,
|
||||||
waiting_for_stream_collection: None,
|
waiting_for_stream_collection: None,
|
||||||
waiting_for_ss_eos: None,
|
waiting_for_ss_eos: None,
|
||||||
waiting_for_pads: None,
|
waiting_for_pads: None,
|
||||||
|
@ -1214,7 +1230,7 @@ impl UriPlaylistBin {
|
||||||
let mut state_guard = self.state.lock().unwrap();
|
let mut state_guard = self.state.lock().unwrap();
|
||||||
let state = state_guard.as_mut().unwrap();
|
let state = state_guard.as_mut().unwrap();
|
||||||
|
|
||||||
if state.errored {
|
if state.status.done() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,10 +1622,10 @@ impl UriPlaylistBin {
|
||||||
let mut state_guard = self.state.lock().unwrap();
|
let mut state_guard = self.state.lock().unwrap();
|
||||||
let state = state_guard.as_mut().unwrap();
|
let state = state_guard.as_mut().unwrap();
|
||||||
|
|
||||||
if state.errored {
|
if state.status.done() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.errored = true;
|
state.status = Status::Error;
|
||||||
|
|
||||||
if let Some(blocked) = state.blocked.take() {
|
if let Some(blocked) = state.blocked.take() {
|
||||||
// unblock streaming thread
|
// unblock streaming thread
|
||||||
|
|
Loading…
Reference in a new issue