mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-19 22:26:20 +00:00
webrtc: Share runtime between webrtcsink and signaller crates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1019>
This commit is contained in:
parent
1ffeb4d44d
commit
877a9bd7f3
3 changed files with 12 additions and 19 deletions
|
@ -1,8 +1,7 @@
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
use crate::webrtcsink::WebRTCSink;
|
use crate::webrtcsink::{RUNTIME, WebRTCSink};
|
||||||
use anyhow::{anyhow, Error};
|
use anyhow::{anyhow, Error};
|
||||||
use tokio::runtime;
|
|
||||||
use tokio::task;
|
use tokio::task;
|
||||||
use async_tungstenite::tungstenite::Message as WsMessage;
|
use async_tungstenite::tungstenite::Message as WsMessage;
|
||||||
use futures::channel::mpsc;
|
use futures::channel::mpsc;
|
||||||
|
@ -25,14 +24,6 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
|
||||||
runtime::Builder::new_multi_thread()
|
|
||||||
.enable_all()
|
|
||||||
.worker_threads(1)
|
|
||||||
.build()
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct State {
|
struct State {
|
||||||
/// Sender for the websocket messages
|
/// Sender for the websocket messages
|
||||||
|
|
|
@ -9,7 +9,6 @@ use gst_utils::StreamProducer;
|
||||||
use gst_video::subclass::prelude::*;
|
use gst_video::subclass::prelude::*;
|
||||||
use gst_webrtc::WebRTCDataChannel;
|
use gst_webrtc::WebRTCDataChannel;
|
||||||
|
|
||||||
use tokio::runtime;
|
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use anyhow::{anyhow, Error};
|
use anyhow::{anyhow, Error};
|
||||||
|
@ -20,6 +19,7 @@ use std::sync::Mutex;
|
||||||
|
|
||||||
use super::homegrown_cc::CongestionController;
|
use super::homegrown_cc::CongestionController;
|
||||||
use super::{WebRTCSinkCongestionControl, WebRTCSinkError, WebRTCSinkMitigationMode};
|
use super::{WebRTCSinkCongestionControl, WebRTCSinkError, WebRTCSinkMitigationMode};
|
||||||
|
use crate::webrtcsink::RUNTIME;
|
||||||
use crate::signaller::Signaller;
|
use crate::signaller::Signaller;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
@ -31,14 +31,6 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
|
||||||
runtime::Builder::new_multi_thread()
|
|
||||||
.enable_all()
|
|
||||||
.worker_threads(1)
|
|
||||||
.build()
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
|
|
||||||
const CUDA_MEMORY_FEATURE: &str = "memory:CUDAMemory";
|
const CUDA_MEMORY_FEATURE: &str = "memory:CUDAMemory";
|
||||||
const GL_MEMORY_FEATURE: &str = "memory:GLMemory";
|
const GL_MEMORY_FEATURE: &str = "memory:GLMemory";
|
||||||
const NVMM_MEMORY_FEATURE: &str = "memory:NVMM";
|
const NVMM_MEMORY_FEATURE: &str = "memory:NVMM";
|
||||||
|
|
|
@ -10,6 +10,8 @@ use gst::glib;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use tokio::runtime;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
mod homegrown_cc;
|
mod homegrown_cc;
|
||||||
mod imp;
|
mod imp;
|
||||||
|
@ -165,3 +167,11 @@ pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||||
WebRTCSink::static_type(),
|
WebRTCSink::static_type(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
||||||
|
runtime::Builder::new_multi_thread()
|
||||||
|
.enable_all()
|
||||||
|
.worker_threads(1)
|
||||||
|
.build()
|
||||||
|
.unwrap()
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue