mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-05-19 00:38:20 +00:00
Compare commits
4 commits
20a5580d3c
...
aeaa0cc58c
Author | SHA1 | Date | |
---|---|---|---|
aeaa0cc58c | |||
a87eaa4b79 | |||
88cbc93338 | |||
406fed2684 |
|
@ -649,7 +649,7 @@ impl BaseTransformImpl for HrtfRender {
|
|||
|
||||
if direction == gst::PadDirection::Sink {
|
||||
s.set("channels", 2);
|
||||
s.set("channel-mask", 0x3);
|
||||
s.set("channel-mask", gst::Bitmask(0x3));
|
||||
} else {
|
||||
let settings = self.settings.lock().unwrap();
|
||||
if let Some(objs) = &settings.spatial_objects {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use crate::signaller::{Signallable, SignallableImpl};
|
||||
use crate::webrtcsink::JanusVRSignallerState;
|
||||
use crate::RUNTIME;
|
||||
|
||||
use anyhow::{anyhow, Error};
|
||||
|
@ -268,6 +269,7 @@ struct State {
|
|||
transaction_id: Option<String>,
|
||||
room_id: Option<JanusId>,
|
||||
feed_id: Option<JanusId>,
|
||||
janus_state: JanusVRSignallerState,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -294,6 +296,20 @@ impl Default for Settings {
|
|||
#[derive(Default, Properties)]
|
||||
#[properties(wrapper_type = super::JanusVRSignaller)]
|
||||
pub struct Signaller {
|
||||
/**
|
||||
* GstJanusVRWebRTCSignaller:janus-state:
|
||||
*
|
||||
* The current state of the signaller.
|
||||
* Since: plugins-rs-0.14.0
|
||||
*/
|
||||
#[property(
|
||||
name = "janus-state",
|
||||
// FIXME: can't use `member =` with enums: https://github.com/gtk-rs/gtk-rs-core/issues/1338
|
||||
get = |self_: &Self| self_.state.lock().unwrap().janus_state,
|
||||
type = JanusVRSignallerState,
|
||||
blurb = "The current state of the signaller",
|
||||
builder(JanusVRSignallerState::Initialized)
|
||||
)]
|
||||
state: Mutex<State>,
|
||||
#[property(name="janus-endpoint", get, set, type = String, member = janus_endpoint, blurb = "The Janus server endpoint to POST SDP offer to")]
|
||||
#[property(name="display-name", get, set, type = String, member = display_name, blurb = "The name of the publisher in the Janus Video Room")]
|
||||
|
@ -445,6 +461,13 @@ impl Signaller {
|
|||
match reply {
|
||||
JsonReply::WebRTCUp => {
|
||||
gst::trace!(CAT, imp: self, "WebRTC streaming is working!");
|
||||
|
||||
{
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.janus_state = JanusVRSignallerState::WebrtcUp;
|
||||
}
|
||||
|
||||
self.obj().notify("janus-state");
|
||||
}
|
||||
JsonReply::Success(success) => {
|
||||
if let Some(data) = success.data {
|
||||
|
@ -457,6 +480,8 @@ impl Signaller {
|
|||
self.set_handle_id(data.id);
|
||||
self.join_room();
|
||||
}
|
||||
|
||||
self.obj().notify("janus-state");
|
||||
}
|
||||
}
|
||||
JsonReply::Event(event) => {
|
||||
|
@ -482,7 +507,12 @@ impl Signaller {
|
|||
}
|
||||
|
||||
gst::trace!(CAT, imp: self, "Joined room {:?} successfully", joined.room);
|
||||
{
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.janus_state = JanusVRSignallerState::RoomJoined;
|
||||
}
|
||||
self.session_requested();
|
||||
self.obj().notify("janus-state");
|
||||
}
|
||||
VideoRoomData::Event(room_event) => {
|
||||
if room_event.error_code.is_some() && room_event.error.is_some() {
|
||||
|
@ -569,11 +599,15 @@ impl Signaller {
|
|||
}
|
||||
|
||||
fn set_session_id(&self, session_id: u64) {
|
||||
self.state.lock().unwrap().session_id = Some(session_id);
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.session_id = Some(session_id);
|
||||
state.janus_state = JanusVRSignallerState::SessionCreated;
|
||||
}
|
||||
|
||||
fn set_handle_id(&self, handle_id: u64) {
|
||||
self.state.lock().unwrap().handle_id = Some(handle_id);
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.handle_id = Some(handle_id);
|
||||
state.janus_state = JanusVRSignallerState::VideoroomAttached;
|
||||
}
|
||||
|
||||
fn attach_plugin(&self) {
|
||||
|
@ -672,7 +706,7 @@ impl Signaller {
|
|||
|
||||
fn publish(&self, offer: &gst_webrtc::WebRTCSessionDescription) {
|
||||
let (transaction, session_id, handle_id, apisecret) = {
|
||||
let state = self.state.lock().unwrap();
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let settings = self.settings.lock().unwrap();
|
||||
|
||||
if settings.room_id.is_none() {
|
||||
|
@ -680,6 +714,8 @@ impl Signaller {
|
|||
return;
|
||||
}
|
||||
|
||||
state.janus_state = JanusVRSignallerState::Negotiating;
|
||||
|
||||
(
|
||||
state.transaction_id.clone().unwrap(),
|
||||
state.session_id.unwrap(),
|
||||
|
@ -687,6 +723,8 @@ impl Signaller {
|
|||
settings.secret_key.clone(),
|
||||
)
|
||||
};
|
||||
self.obj().notify("janus-state");
|
||||
|
||||
let sdp_data = offer.sdp().as_text().unwrap();
|
||||
self.send(OutgoingMessage::Publish(PublishMsg {
|
||||
janus: "message".to_string(),
|
||||
|
|
|
@ -134,6 +134,26 @@ enum WebRTCSinkMitigationMode {
|
|||
DOWNSAMPLED = 0b00000010,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)]
|
||||
#[repr(u32)]
|
||||
#[enum_type(name = "GstJanusVRWebRTCJanusState")]
|
||||
/// State of the Janus Signaller.
|
||||
pub enum JanusVRSignallerState {
|
||||
#[default]
|
||||
/// Initial state when the signaller is created.
|
||||
Initialized,
|
||||
/// The Janus session has been created.
|
||||
SessionCreated,
|
||||
/// The session has been attached to the videoroom plugin.
|
||||
VideoroomAttached,
|
||||
/// The room has been joined.
|
||||
RoomJoined,
|
||||
/// The WebRTC stream is being negotiated.
|
||||
Negotiating,
|
||||
/// The WebRTC stream is streaming to Janus.
|
||||
WebrtcUp,
|
||||
}
|
||||
|
||||
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
WebRTCSinkPad::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
BaseWebRTCSink::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
|
@ -223,6 +243,7 @@ pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
|||
* - This plugin supports both the legacy Video Room plugin as well as the `multistream` one;
|
||||
* - If you see a warning in the logs related to `rtpgccbwe`, you're probably missing the `gst-plugin-rtp` in your system.
|
||||
*/
|
||||
JanusVRSignallerState::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
gst::Element::register(
|
||||
Some(plugin),
|
||||
"janusvrwebrtcsink",
|
||||
|
|
|
@ -134,7 +134,7 @@ impl Dav1dDec {
|
|||
let matrix = match pic.matrix_coefficients() {
|
||||
pixel::MatrixCoefficients::Identity => gst_video::VideoColorMatrix::Rgb,
|
||||
pixel::MatrixCoefficients::BT709 => gst_video::VideoColorMatrix::Bt709,
|
||||
pixel::MatrixCoefficients::Unspecified => gst_video::VideoColorMatrix::Unknown,
|
||||
pixel::MatrixCoefficients::Unspecified => gst_video::VideoColorMatrix::Bt709,
|
||||
pixel::MatrixCoefficients::BT470M => gst_video::VideoColorMatrix::Fcc,
|
||||
pixel::MatrixCoefficients::BT470BG => gst_video::VideoColorMatrix::Bt601,
|
||||
pixel::MatrixCoefficients::ST240M => gst_video::VideoColorMatrix::Smpte240m,
|
||||
|
@ -149,7 +149,7 @@ impl Dav1dDec {
|
|||
|
||||
let transfer = match pic.transfer_characteristic() {
|
||||
pixel::TransferCharacteristic::BT1886 => gst_video::VideoTransferFunction::Bt709,
|
||||
pixel::TransferCharacteristic::Unspecified => gst_video::VideoTransferFunction::Unknown,
|
||||
pixel::TransferCharacteristic::Unspecified => gst_video::VideoTransferFunction::Bt709,
|
||||
pixel::TransferCharacteristic::BT470M => gst_video::VideoTransferFunction::Bt709,
|
||||
pixel::TransferCharacteristic::BT470BG => gst_video::VideoTransferFunction::Gamma28,
|
||||
pixel::TransferCharacteristic::ST170M => gst_video::VideoTransferFunction::Bt601,
|
||||
|
@ -180,7 +180,7 @@ impl Dav1dDec {
|
|||
|
||||
let primaries = match pic.color_primaries() {
|
||||
pixel::ColorPrimaries::BT709 => gst_video::VideoColorPrimaries::Bt709,
|
||||
pixel::ColorPrimaries::Unspecified => gst_video::VideoColorPrimaries::Unknown,
|
||||
pixel::ColorPrimaries::Unspecified => gst_video::VideoColorPrimaries::Bt709,
|
||||
pixel::ColorPrimaries::BT470M => gst_video::VideoColorPrimaries::Bt470m,
|
||||
pixel::ColorPrimaries::BT470BG => gst_video::VideoColorPrimaries::Bt470bg,
|
||||
pixel::ColorPrimaries::ST240M => gst_video::VideoColorPrimaries::Smpte240m,
|
||||
|
|
Loading…
Reference in a new issue