added support for some colibri signalling via gst-meet tool
This commit is contained in:
parent
6f67e2536d
commit
e5ed8d89f6
|
@ -1,6 +1,6 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use cocoa::appkit::NSApplication;
|
use cocoa::appkit::NSApplication;
|
||||||
use glib::ObjectExt;
|
use glib::ObjectExt;
|
||||||
|
@ -8,7 +8,10 @@ use gstreamer::{
|
||||||
prelude::{ElementExt, GstBinExt},
|
prelude::{ElementExt, GstBinExt},
|
||||||
GhostPad,
|
GhostPad,
|
||||||
};
|
};
|
||||||
use lib_gst_meet::{init_tracing, JitsiConferenceConfig, JitsiConnection};
|
use lib_gst_meet::{
|
||||||
|
init_tracing, JitsiConferenceConfig, JitsiConnection,
|
||||||
|
colibri::{ColibriMessage, Constraints, VideoType},
|
||||||
|
};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use tokio::{signal::ctrl_c, task, time::timeout};
|
use tokio::{signal::ctrl_c, task, time::timeout};
|
||||||
use tracing::{info, trace, warn};
|
use tracing::{info, trace, warn};
|
||||||
|
@ -39,6 +42,14 @@ struct Opt {
|
||||||
send_pipeline: Option<String>,
|
send_pipeline: Option<String>,
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
recv_pipeline_participant_template: Option<String>,
|
recv_pipeline_participant_template: Option<String>,
|
||||||
|
#[structopt(long)]
|
||||||
|
select_endpoints: Option<String>,
|
||||||
|
#[structopt(long)]
|
||||||
|
last_n: Option<u16>,
|
||||||
|
#[structopt(long)]
|
||||||
|
recv_video_height: Option<u16>,
|
||||||
|
#[structopt(long)]
|
||||||
|
video_type: Option<String>,
|
||||||
#[structopt(short, long, parse(from_occurrences))]
|
#[structopt(short, long, parse(from_occurrences))]
|
||||||
verbose: u8,
|
verbose: u8,
|
||||||
}
|
}
|
||||||
|
@ -139,6 +150,32 @@ async fn main_inner() -> Result<()> {
|
||||||
.join_conference(main_loop.context(), config)
|
.join_conference(main_loop.context(), config)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if opt.select_endpoints.is_some() || opt.last_n.is_some() || opt.recv_video_height.is_some() {
|
||||||
|
conference
|
||||||
|
.send_colibri_message(ColibriMessage::ReceiverVideoConstraints {
|
||||||
|
last_n: opt.last_n,
|
||||||
|
selected_endpoints: opt.select_endpoints.map(|endpoints| endpoints.split(',').map(ToOwned::to_owned).collect()),
|
||||||
|
on_stage_endpoints: None,
|
||||||
|
default_constraints: opt.recv_video_height.map(|height| Constraints {
|
||||||
|
ideal_height: Some(height),
|
||||||
|
max_height: None,
|
||||||
|
}),
|
||||||
|
constraints: None,
|
||||||
|
}).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(video_type) = opt.video_type {
|
||||||
|
conference
|
||||||
|
.send_colibri_message(ColibriMessage::VideoTypeMessage {
|
||||||
|
video_type: match video_type.as_str() {
|
||||||
|
"camera" => VideoType::Camera,
|
||||||
|
"desktop" => VideoType::Desktop,
|
||||||
|
other => bail!(format!("invalid video type: {}", other)),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(bin) = parsed_bin {
|
if let Some(bin) = parsed_bin {
|
||||||
conference.add_bin(&bin).await?;
|
conference.add_bin(&bin).await?;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lib-gst-meet"
|
name = "lib-gst-meet"
|
||||||
description = "Connect GStreamer pipelines to Jitsi Meet conferences"
|
description = "Connect GStreamer pipelines to Jitsi Meet conferences"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
authors = ["Jasper Hugo <jasper@avstack.io>"]
|
authors = ["Jasper Hugo <jasper@avstack.io>"]
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub enum ColibriMessage {
|
||||||
selected_endpoints: Option<Vec<String>>,
|
selected_endpoints: Option<Vec<String>>,
|
||||||
on_stage_endpoints: Option<Vec<String>>,
|
on_stage_endpoints: Option<Vec<String>>,
|
||||||
default_constraints: Option<Constraints>,
|
default_constraints: Option<Constraints>,
|
||||||
constraints: HashMap<String, Constraints>,
|
constraints: Option<HashMap<String, Constraints>>,
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
SelectedEndpointsChangedEvent {
|
SelectedEndpointsChangedEvent {
|
||||||
|
@ -75,39 +75,46 @@ pub enum ColibriMessage {
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
VideoTypeMessage {
|
VideoTypeMessage {
|
||||||
video_type: String,
|
video_type: VideoType,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub enum VideoType {
|
||||||
|
Camera,
|
||||||
|
Desktop,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Constraints {
|
pub struct Constraints {
|
||||||
ideal_height: Option<u16>,
|
pub ideal_height: Option<u16>,
|
||||||
max_height: Option<u16>,
|
pub max_height: Option<u16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Bitrates {
|
pub struct Bitrates {
|
||||||
audio: Bitrate,
|
pub audio: Bitrate,
|
||||||
video: Bitrate,
|
pub video: Bitrate,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
total: Bitrate,
|
pub total: Bitrate,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Bitrate {
|
pub struct Bitrate {
|
||||||
upload: u32,
|
pub upload: u32,
|
||||||
download: u32,
|
pub download: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PacketLoss {
|
pub struct PacketLoss {
|
||||||
total: u32,
|
pub total: u32,
|
||||||
download: u32,
|
pub download: u32,
|
||||||
upload: u32,
|
pub upload: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct ColibriChannel {
|
pub(crate) struct ColibriChannel {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
mod colibri;
|
pub mod colibri;
|
||||||
mod conference;
|
mod conference;
|
||||||
mod connection;
|
mod connection;
|
||||||
mod jingle;
|
mod jingle;
|
||||||
|
|
Loading…
Reference in New Issue