From a0121315b7bc5a03e11ac043b550d10786a0476e Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Sat, 10 Aug 2024 21:01:32 -0700 Subject: [PATCH] found an example to recreate --- Cargo.lock | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 12 +++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index f62a7b9..35630d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -486,6 +486,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bitstream-io" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e" + [[package]] name = "block-buffer" version = "0.10.4" @@ -501,6 +507,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "byteorder" version = "1.5.0" @@ -978,6 +990,39 @@ dependencies = [ "system-deps", ] +[[package]] +name = "gst-plugin-rtp" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c73a24533857d3c5d5de3a512a381e43b92d93089828a0a705d7d81e326f128" +dependencies = [ + "anyhow", + "atomic_refcell", + "bitstream-io", + "byte-slice-cast", + "chrono", + "futures", + "gio", + "gst-plugin-version-helper", + "gstreamer", + "gstreamer-audio", + "gstreamer-base", + "gstreamer-net", + "gstreamer-rtp", + "gstreamer-video", + "hex", + "log", + "once_cell", + "rand", + "rtcp-types", + "rtp-types", + "slab", + "smallvec", + "thiserror", + "time", + "tokio", +] + [[package]] name = "gst-plugin-version-helper" version = "0.8.2" @@ -2412,6 +2457,25 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "rtcp-types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5248489db464de29835170cd1f6e19933146b0016789effc59cb53d9f13844" +dependencies = [ + "thiserror", +] + +[[package]] +name = "rtp-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01b38bb7fd9425628876786934ade84ec5cb63905804f073583e6554d33f9af" +dependencies = [ + "smallvec", + "thiserror", +] + [[package]] name = "rust-ini" version = "0.19.0" @@ -3251,6 +3315,7 @@ dependencies = [ "anyhow", "config", "ctrlc", + "gst-plugin-rtp", "gst-plugin-webrtc", "gstreamer", "log", diff --git a/Cargo.toml b/Cargo.toml index 046b62f..551f0e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ anyhow = "1.0.86" config = "0.14.0" ctrlc = "3.4.4" gst-plugin-webrtc = { version = "0.13.0", features = ["v1_22"] } +gst-plugin-rtp = "0.13.0" gstreamer = { version = "0.23.0", features = ["v1_22"] } log = "0.4.22" serde = { version = "1.0.204", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index 24fc879..1dca7ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,14 @@ fn main() -> Result<(), Error> { gstreamer::init()?; gstrswebrtc::plugin_register_static()?; + gstrsrtp::plugin_register_static()?; + + // working pipeline + // gst-launch-1.0 videotestsrc \ + // ! video/x-raw,width=1920,height=1080,format=I420 \ + // ! x264enc speed-preset=ultrafast bitrate=2000 \ + // ! video/x-h264,profile=baseline \ + // ! whipclientsink signaller::whip-endpoint=http://localhost:8889/mystream/whip let pipeline = Pipeline::with_name("rstp-pipeline"); @@ -30,6 +38,8 @@ fn main() -> Result<(), Error> { .build().unwrap(); let convert = ElementFactory::make("x264enc") + .property("speed-preset", "ultrafast") + .property("bitrate", 2000) .build().unwrap(); let whipsink = gstreamer::ElementFactory::make("whipclientsink") @@ -40,7 +50,7 @@ fn main() -> Result<(), Error> { let signaller = whipsink.property::("signaller"); signaller.set_property_from_str( "whip-endpoint", - &format!("http://localhost:{}/{}/whip", 8889, "mystream"), + &format!("http://localhost:{}/whip", 8889), ); }