Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@onestream.live>2022-04-08 12:21:42 +0300
committerGuillaume Desmottes <guillaume.desmottes@onestream.live>2022-04-08 17:53:12 +0300
commite3e4a109f9cc5c723aa1f7646f4bfdb4392f61d4 (patch)
tree4b10dd1a44fdeb55dc19cb2396f20e817e30e609 /utils/uriplaylistbin/src
parent2eb4a8209372471e0e7d48934f8fccddfe43912d (diff)
uriplaylistbin: replace errored with Status enum
Diffstat (limited to 'utils/uriplaylistbin/src')
-rw-r--r--utils/uriplaylistbin/src/uriplaylistbin/imp.rs28
1 files changed, 22 insertions, 6 deletions
diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
index 4198c991..2513554c 100644
--- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
+++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
@@ -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 {
streamsynchronizer: gst::Element,
concat_audio: Vec<gst::Element>,
@@ -111,8 +128,7 @@ struct State {
/// the current number of streams handled by the element
streams_topology: StreamsTopology,
- // true if the element stopped because of an error
- errored: bool,
+ status: Status,
// we have max one item in one of each of those states
waiting_for_stream_collection: Option<Item>,
@@ -138,7 +154,7 @@ impl State {
streamsynchronizer,
playlist: Playlist::new(uris, iterations),
streams_topology: StreamsTopology::default(),
- errored: false,
+ status: Status::Running,
waiting_for_stream_collection: None,
waiting_for_ss_eos: None,
waiting_for_pads: None,
@@ -1214,7 +1230,7 @@ impl UriPlaylistBin {
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().unwrap();
- if state.errored {
+ if state.status.done() {
return;
}
@@ -1606,10 +1622,10 @@ impl UriPlaylistBin {
let mut state_guard = self.state.lock().unwrap();
let state = state_guard.as_mut().unwrap();
- if state.errored {
+ if state.status.done() {
return;
}
- state.errored = true;
+ state.status = Status::Error;
if let Some(blocked) = state.blocked.take() {
// unblock streaming thread