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

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun@asymptotic.io>2023-02-14 19:01:55 +0300
committerArun Raghavan <arun@asymptotic.io>2023-02-14 19:25:44 +0300
commit487d7fb26b297f74c7aba6736f0ee75762ddf98e (patch)
tree1ee19959808bded6a7cf68dacd2f2a1bd1f6f6b3 /net/hlssink3
parent77e99e92fb8554c7d4b0273e8c20a63202bf8053 (diff)
hlssink3: Allow GIOStream signal handlers to return None
If creating a playlist or fragment stream fails (disk is full, the directory is removed, ...), we will currently crash because the signal handler expects a non-None GIOStream. The actual callback is allowed to return None values and we handle this in the caller, so let's not have this restriction on the signal handler. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1093>
Diffstat (limited to 'net/hlssink3')
-rw-r--r--net/hlssink3/src/imp.rs23
1 files changed, 7 insertions, 16 deletions
diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs
index 3dab2887b..4b6c8668c 100644
--- a/net/hlssink3/src/imp.rs
+++ b/net/hlssink3/src/imp.rs
@@ -417,7 +417,7 @@ impl BinImpl for HlsSink3 {
"splitmuxsink-fragment-closed" => {
let s = msg.structure().unwrap();
if let Ok(fragment_closed_at) = s.get::<gst::ClockTime>("running-time") {
- self.write_playlist(Some(fragment_closed_at)).unwrap();
+ let _ = self.write_playlist(Some(fragment_closed_at));
}
}
_ => {}
@@ -574,7 +574,7 @@ impl ObjectImpl for HlsSink3 {
vec![
glib::subclass::Signal::builder(SIGNAL_GET_PLAYLIST_STREAM)
.param_types([String::static_type()])
- .return_type::<gio::OutputStream>()
+ .return_type::<Option<gio::OutputStream>>()
.class_handler(|_, args| {
let element = args[0]
.get::<super::HlsSink3>()
@@ -583,12 +583,7 @@ impl ObjectImpl for HlsSink3 {
args[1].get::<String>().expect("playlist-stream signal arg");
let hlssink3 = element.imp();
- Some(
- hlssink3
- .new_file_stream(&playlist_location)
- .ok()?
- .to_value(),
- )
+ Some(hlssink3.new_file_stream(&playlist_location).ok().to_value())
})
.accumulator(|_hint, ret, value| {
// First signal handler wins
@@ -598,7 +593,7 @@ impl ObjectImpl for HlsSink3 {
.build(),
glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM)
.param_types([String::static_type()])
- .return_type::<gio::OutputStream>()
+ .return_type::<Option<gio::OutputStream>>()
.class_handler(|_, args| {
let element = args[0]
.get::<super::HlsSink3>()
@@ -607,12 +602,7 @@ impl ObjectImpl for HlsSink3 {
args[1].get::<String>().expect("fragment-stream signal arg");
let hlssink3 = element.imp();
- Some(
- hlssink3
- .new_file_stream(&fragment_location)
- .ok()?
- .to_value(),
- )
+ Some(hlssink3.new_file_stream(&fragment_location).ok().to_value())
})
.accumulator(|_hint, ret, value| {
// First signal handler wins
@@ -767,7 +757,8 @@ impl ElementImpl for HlsSink3 {
};
if write_final {
- self.write_final_playlist()?;
+ // Don't fail transitioning to READY if this fails
+ let _ = self.write_final_playlist();
}
}
gst::StateChange::ReadyToNull => {