diff --git a/net/webrtc/src/lib.rs b/net/webrtc/src/lib.rs index a0de1937..bf1432b5 100644 --- a/net/webrtc/src/lib.rs +++ b/net/webrtc/src/lib.rs @@ -7,6 +7,8 @@ * Since: plugins-rs-0.9 */ use gst::glib; +use tokio::runtime; +use once_cell::sync::Lazy; mod signaller; pub mod webrtcsink; @@ -28,3 +30,11 @@ gst::plugin_define!( env!("CARGO_PKG_REPOSITORY"), env!("BUILD_REL_DATE") ); + +pub static RUNTIME: Lazy = Lazy::new(|| { + runtime::Builder::new_multi_thread() + .enable_all() + .worker_threads(1) + .build() + .unwrap() +}); diff --git a/net/webrtc/src/signaller/imp.rs b/net/webrtc/src/signaller/imp.rs index bb72200c..4928960f 100644 --- a/net/webrtc/src/signaller/imp.rs +++ b/net/webrtc/src/signaller/imp.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -use crate::webrtcsink::{WebRTCSink, RUNTIME}; +use crate::{webrtcsink::WebRTCSink, RUNTIME}; use anyhow::{anyhow, Error}; use async_tungstenite::tungstenite::Message as WsMessage; use futures::channel::mpsc; diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index a7fe316e..8221ebe3 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -20,7 +20,7 @@ use std::sync::Mutex; use super::homegrown_cc::CongestionController; use super::{WebRTCSinkCongestionControl, WebRTCSinkError, WebRTCSinkMitigationMode}; use crate::signaller::Signaller; -use crate::webrtcsink::RUNTIME; +use crate::RUNTIME; use std::collections::BTreeMap; static CAT: Lazy = Lazy::new(|| { diff --git a/net/webrtc/src/webrtcsink/mod.rs b/net/webrtc/src/webrtcsink/mod.rs index 9df6f0f3..39480559 100644 --- a/net/webrtc/src/webrtcsink/mod.rs +++ b/net/webrtc/src/webrtcsink/mod.rs @@ -9,9 +9,7 @@ use gst::glib; use gst::prelude::*; use gst::subclass::prelude::*; -use once_cell::sync::Lazy; use std::error::Error; -use tokio::runtime; mod homegrown_cc; mod imp; @@ -167,11 +165,3 @@ pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { WebRTCSink::static_type(), ) } - -pub static RUNTIME: Lazy = Lazy::new(|| { - runtime::Builder::new_multi_thread() - .enable_all() - .worker_threads(1) - .build() - .unwrap() -});