diff options
author | Arun Raghavan <arun@asymptotic.io> | 2023-10-13 15:56:16 +0300 |
---|---|---|
committer | Arun Raghavan <arun@arunraghavan.net> | 2023-10-25 00:03:14 +0300 |
commit | d27a04e0675b3ce9b2f5b885dd3a5a0b04ee7b47 (patch) | |
tree | f3014d29457cebdbe25b3d4ac925bbea80a780d4 /net | |
parent | a49a5dcb11c736897ddadc04173cc46a5806aa00 (diff) |
hlssink3: Close the playlist giostreamsink on stop if possible
This is a property that will be available from GStreamer 1.24, and will
ensure that we are able to flush the playlist during the READY->NULL
transition instead of when the element is freed.
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/423
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1360>
Diffstat (limited to 'net')
-rw-r--r-- | net/hlssink3/src/imp.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs index 1c0cfeebc..7fafa6489 100644 --- a/net/hlssink3/src/imp.rs +++ b/net/hlssink3/src/imp.rs @@ -627,6 +627,19 @@ impl Default for HlsSink3Settings { .property("sink", &giostreamsink) .build() .expect("Could not make element splitmuxsink"); + + // giostreamsink doesn't let go of its stream until the element is finalized, which might + // be too late for the calling application. Let's try to force it to close while tearing + // down the pipeline. + if giostreamsink.has_property("close-on-stop", Some(bool::static_type())) { + giostreamsink.set_property("close-on-stop", true); + } else { + gst::warning!( + CAT, + "hlssink3 may sometimes fail to write out the final playlist update. This can be fixed by using giostreamsink from GStreamer 1.24 or later." + ) + } + Self { location: String::from(DEFAULT_TS_LOCATION), target_duration: DEFAULT_TARGET_DURATION, |