Skip to content

Commit

Permalink
src: lib: stream: sink: rtsp_sink: Better deal with socket file
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Oct 1, 2024
1 parent 432a7c5 commit 8b7b654
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/stream/sink/rtsp_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,15 @@ impl RtspSink {
"Failed to find RTSP compatible address. Example: \"rtsp://0.0.0.0:8554/test\"",
)?;

let socket_path = format!("/tmp/{id}");
let socket_path = {
let path = std::env::temp_dir().join(format!("{id}.sock"));

if path.try_exists()? {
std::fs::remove_file(path.clone())?;
}
path.to_string_lossy().to_string()
};

let sink = gst::ElementFactory::make("shmsink")
.property_from_str("socket-path", &socket_path)
.property("sync", false)
Expand Down

0 comments on commit 8b7b654

Please sign in to comment.