resolved merge
This commit is contained in:
parent
27504d9754
commit
cf4cf3feb9
7 changed files with 884 additions and 2433 deletions
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"rust-analyzer.linkedProjects": [
|
|
||||||
"./helloworld/Cargo.toml",
|
|
||||||
]
|
|
||||||
}
|
|
3141
Cargo.lock
generated
3141
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
18
Cargo.toml
18
Cargo.toml
|
@ -9,24 +9,16 @@ edition = "2021"
|
||||||
anyhow = "1.0.86"
|
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-webrtchttp = "0.13.0"
|
gstreamer = { version = "0.23.0", features = ["v1_22"] }
|
||||||
gst-plugin-rtp = "0.13.0"
|
gstreamer-app = { version = "0.23.0", features = ["v1_22"] }
|
||||||
gst-plugin-rtsp = "0.13.0"
|
|
||||||
gst-plugin-hlssink3 = "0.13.0"
|
|
||||||
gst-plugin-reqwest = "0.13.0"
|
|
||||||
|
|
||||||
gstreamer = { version = "0.23.0", features = ["v1_24"] }
|
|
||||||
gstreamer-webrtc = { version = "0.23.0", features = ["v1_22"] }
|
|
||||||
lazy_static = "1.5.0"
|
|
||||||
log = "0.4.22"
|
log = "0.4.22"
|
||||||
serde = { version = "1.0.204", features = ["derive"] }
|
serde = { version = "1.0.204", features = ["derive"] }
|
||||||
serde_json = "1.0.122"
|
serde_json = "1.0.122"
|
||||||
snafu = "0.8.4"
|
snafu = "0.8.4"
|
||||||
# tokio = "1.39.2"
|
tokio = "1.39.2"
|
||||||
# tokio-tungstenite = "0.23.1"
|
tokio-tungstenite = "0.23.1"
|
||||||
toml = "0.8.19"
|
toml = "0.8.19"
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.18"
|
||||||
tungstenite = "0.23.0"
|
webrtc = "0.11.0"
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
webrtcAdditionalHosts: [localhost, 0.0.0.0, 127.0.0.1, 10.0.0.114]
|
|
||||||
|
|
||||||
logLevel: debug
|
|
||||||
webrtcLocalTCPAddress: :8188
|
|
||||||
api: yes
|
|
||||||
|
|
||||||
paths:
|
|
||||||
mystream:
|
|
||||||
source: publisher
|
|
|
@ -1,13 +0,0 @@
|
||||||
|
|
||||||
api: no
|
|
||||||
apiAddress: :9997
|
|
||||||
apiEncryption: no
|
|
||||||
|
|
||||||
paths:
|
|
||||||
mystream:
|
|
||||||
source: publisher
|
|
||||||
|
|
||||||
webrtc: yes
|
|
||||||
webrtcAddress: :8889
|
|
||||||
webrtcLocalUDPAddress: :8189
|
|
||||||
webrtcEncryption: no
|
|
|
@ -1,110 +0,0 @@
|
||||||
use std::sync::Mutex;
|
|
||||||
|
|
||||||
use gstreamer::glib;
|
|
||||||
use gstreamer::subclass::prelude::*;
|
|
||||||
use gstreamer_webrtc::WebRTCSessionDescription;
|
|
||||||
use gstrswebrtc::signaller::{Signallable, SignallableImpl};
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use std::sync::mpsc::Sender;
|
|
||||||
use tracing::error;
|
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
pub static ref SENDER_CHANNEL: Mutex<Option<Sender<SignallerEvent>>> = Mutex::new(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum SignallerEvent {
|
|
||||||
Start,
|
|
||||||
Stop,
|
|
||||||
SendSDP(SdpMessage),
|
|
||||||
AddICE(ICE),
|
|
||||||
End(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ICE {
|
|
||||||
pub session_id: String,
|
|
||||||
pub candidate: String,
|
|
||||||
pub sdp_m_line_index: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum SdpMessage {
|
|
||||||
Offer(String),
|
|
||||||
Answer(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct Signaller {}
|
|
||||||
|
|
||||||
impl Signaller {}
|
|
||||||
|
|
||||||
impl SignallableImpl for Signaller {
|
|
||||||
fn start(&self) {
|
|
||||||
SENDER_CHANNEL.lock().unwrap().as_ref().map(|msg_bus| {
|
|
||||||
if let Err(e) = msg_bus.send(SignallerEvent::Start) {
|
|
||||||
error!("Could not send message from the signaller to the message bus! {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn stop(&self) {
|
|
||||||
SENDER_CHANNEL.lock().unwrap().as_ref().map(|msg_bus| {
|
|
||||||
if let Err(e) = msg_bus.send(SignallerEvent::Stop) {
|
|
||||||
error!("Could not send message from the signaller to the message bus! {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send_sdp(&self, _session_id: &str, sdp: &WebRTCSessionDescription) {
|
|
||||||
let message = {
|
|
||||||
if sdp.type_() == gstreamer_webrtc::WebRTCSDPType::Offer {
|
|
||||||
SdpMessage::Offer(sdp.sdp().as_text().unwrap())
|
|
||||||
} else {
|
|
||||||
SdpMessage::Answer(sdp.sdp().as_text().unwrap())
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SENDER_CHANNEL.lock().unwrap().as_ref().map(|msg_bus| {
|
|
||||||
if let Err(e) = msg_bus.send(SignallerEvent::SendSDP(message)) {
|
|
||||||
error!("Could not send message from the signaller to the message bus! {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_ice(
|
|
||||||
&self,
|
|
||||||
session_id: &str,
|
|
||||||
candidate: &str,
|
|
||||||
sdp_m_line_index: u32,
|
|
||||||
_sdp_mid: Option<String>,
|
|
||||||
) {
|
|
||||||
let ice_msg = ICE {
|
|
||||||
session_id: session_id.to_string(),
|
|
||||||
candidate: candidate.to_string(),
|
|
||||||
sdp_m_line_index,
|
|
||||||
};
|
|
||||||
|
|
||||||
SENDER_CHANNEL.lock().unwrap().as_ref().map(|msg_bus| {
|
|
||||||
if let Err(e) = msg_bus.send(SignallerEvent::AddICE(ice_msg)) {
|
|
||||||
error!("Could not send message from the signaller to the message bus! {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn end_session(&self, sess_id: &str) {
|
|
||||||
let session_id = sess_id.to_string();
|
|
||||||
SENDER_CHANNEL.lock().unwrap().as_ref().map(|msg_bus| {
|
|
||||||
if let Err(e) = msg_bus.send(SignallerEvent::End(session_id)) {
|
|
||||||
error!("Could not send message from the signaller to the message bus! {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[glib::object_subclass]
|
|
||||||
impl ObjectSubclass for Signaller {
|
|
||||||
const NAME: &'static str = "MyCustomWebRTCSinkSignaller";
|
|
||||||
type Type = super::MyCustomSignaller;
|
|
||||||
type ParentType = glib::Object;
|
|
||||||
type Interfaces = (Signallable,);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ObjectImpl for Signaller {}
|
|
|
@ -1,21 +0,0 @@
|
||||||
use gstreamer::glib;
|
|
||||||
use gstrswebrtc::signaller::Signallable;
|
|
||||||
|
|
||||||
mod imp;
|
|
||||||
pub use imp::{SdpMessage, SignallerEvent, ICE, SENDER_CHANNEL};
|
|
||||||
|
|
||||||
glib::wrapper! {
|
|
||||||
pub struct MyCustomSignaller(ObjectSubclass<imp::Signaller>) @implements Signallable;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MyCustomSignaller {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
glib::Object::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for MyCustomSignaller {
|
|
||||||
fn default() -> Self {
|
|
||||||
MyCustomSignaller::new()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue