found an example to recreate

This commit is contained in:
Nickiel12 2024-08-10 21:01:32 -07:00
parent 823f1313af
commit a0121315b7
3 changed files with 77 additions and 1 deletions

65
Cargo.lock generated
View file

@ -486,6 +486,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "bitstream-io"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.10.4" version = "0.10.4"
@ -501,6 +507,12 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byte-slice-cast"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.5.0" version = "1.5.0"
@ -978,6 +990,39 @@ dependencies = [
"system-deps", "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]] [[package]]
name = "gst-plugin-version-helper" name = "gst-plugin-version-helper"
version = "0.8.2" version = "0.8.2"
@ -2412,6 +2457,25 @@ dependencies = [
"serde_derive", "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]] [[package]]
name = "rust-ini" name = "rust-ini"
version = "0.19.0" version = "0.19.0"
@ -3251,6 +3315,7 @@ dependencies = [
"anyhow", "anyhow",
"config", "config",
"ctrlc", "ctrlc",
"gst-plugin-rtp",
"gst-plugin-webrtc", "gst-plugin-webrtc",
"gstreamer", "gstreamer",
"log", "log",

View file

@ -10,6 +10,7 @@ anyhow = "1.0.86"
config = "0.14.0" config = "0.14.0"
ctrlc = "3.4.4" ctrlc = "3.4.4"
gst-plugin-webrtc = { version = "0.13.0", features = ["v1_22"] } gst-plugin-webrtc = { version = "0.13.0", features = ["v1_22"] }
gst-plugin-rtp = "0.13.0"
gstreamer = { version = "0.23.0", features = ["v1_22"] } gstreamer = { version = "0.23.0", features = ["v1_22"] }
log = "0.4.22" log = "0.4.22"
serde = { version = "1.0.204", features = ["derive"] } serde = { version = "1.0.204", features = ["derive"] }

View file

@ -22,6 +22,14 @@ fn main() -> Result<(), Error> {
gstreamer::init()?; gstreamer::init()?;
gstrswebrtc::plugin_register_static()?; 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"); let pipeline = Pipeline::with_name("rstp-pipeline");
@ -30,6 +38,8 @@ fn main() -> Result<(), Error> {
.build().unwrap(); .build().unwrap();
let convert = ElementFactory::make("x264enc") let convert = ElementFactory::make("x264enc")
.property("speed-preset", "ultrafast")
.property("bitrate", 2000)
.build().unwrap(); .build().unwrap();
let whipsink = gstreamer::ElementFactory::make("whipclientsink") let whipsink = gstreamer::ElementFactory::make("whipclientsink")
@ -40,7 +50,7 @@ fn main() -> Result<(), Error> {
let signaller = whipsink.property::<Signallable>("signaller"); let signaller = whipsink.property::<Signallable>("signaller");
signaller.set_property_from_str( signaller.set_property_from_str(
"whip-endpoint", "whip-endpoint",
&format!("http://localhost:{}/{}/whip", 8889, "mystream"), &format!("http://localhost:{}/whip", 8889),
); );
} }