mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-22 09:00:59 +00:00
pipeline: cleanup the start_pipeline error handling
Cleanup the code to handle GStreamer set_state failure.
This commit is contained in:
parent
1a8e893169
commit
0cd2490cbb
1 changed files with 7 additions and 13 deletions
|
@ -127,21 +127,15 @@ impl Pipeline {
|
||||||
self.create_pipeline(&self.render_gst_launch(graphview))
|
self.create_pipeline(&self.render_gst_launch(graphview))
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
GPS_ERROR!("Unable to start a pipeline: {}", err);
|
GPS_ERROR!("Unable to start a pipeline: {}", err);
|
||||||
})
|
err
|
||||||
.unwrap();
|
})?;
|
||||||
self.set_state(new_state)
|
|
||||||
.map_err(|_| GPS_ERROR!("Unable to change state"))
|
|
||||||
.unwrap();
|
|
||||||
} else if self.state() == PipelineState::Paused {
|
|
||||||
self.set_state(PipelineState::Playing)
|
|
||||||
.map_err(|_| GPS_ERROR!("Unable to change state"))
|
|
||||||
.unwrap();
|
|
||||||
} else {
|
|
||||||
self.set_state(PipelineState::Paused)
|
|
||||||
.map_err(|_| GPS_ERROR!("Unable to change state"))
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.set_state(new_state).map_err(|error| {
|
||||||
|
GPS_ERROR!("Unable to change state {}", error);
|
||||||
|
error
|
||||||
|
})?;
|
||||||
|
|
||||||
Ok(self.state())
|
Ok(self.state())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue