mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-11 03:35:26 +00:00
webrtcsink: Move RUNTIME to the crate so it can be reused
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/932>
This commit is contained in:
parent
4ec441560b
commit
0ae637f531
4 changed files with 12 additions and 12 deletions
|
@ -7,6 +7,8 @@
|
||||||
* Since: plugins-rs-0.9
|
* Since: plugins-rs-0.9
|
||||||
*/
|
*/
|
||||||
use gst::glib;
|
use gst::glib;
|
||||||
|
use tokio::runtime;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
mod signaller;
|
mod signaller;
|
||||||
pub mod webrtcsink;
|
pub mod webrtcsink;
|
||||||
|
@ -28,3 +30,11 @@ gst::plugin_define!(
|
||||||
env!("CARGO_PKG_REPOSITORY"),
|
env!("CARGO_PKG_REPOSITORY"),
|
||||||
env!("BUILD_REL_DATE")
|
env!("BUILD_REL_DATE")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
pub static RUNTIME: Lazy<runtime::Runtime> = Lazy::new(|| {
|
||||||
|
runtime::Builder::new_multi_thread()
|
||||||
|
.enable_all()
|
||||||
|
.worker_threads(1)
|
||||||
|
.build()
|
||||||
|
.unwrap()
|
||||||
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
use crate::webrtcsink::{WebRTCSink, RUNTIME};
|
use crate::{webrtcsink::WebRTCSink, RUNTIME};
|
||||||
use anyhow::{anyhow, Error};
|
use anyhow::{anyhow, Error};
|
||||||
use async_tungstenite::tungstenite::Message as WsMessage;
|
use async_tungstenite::tungstenite::Message as WsMessage;
|
||||||
use futures::channel::mpsc;
|
use futures::channel::mpsc;
|
||||||
|
|
|
@ -20,7 +20,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::signaller::Signaller;
|
use crate::signaller::Signaller;
|
||||||
use crate::webrtcsink::RUNTIME;
|
use crate::RUNTIME;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
use gst::glib;
|
use gst::glib;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use tokio::runtime;
|
|
||||||
|
|
||||||
mod homegrown_cc;
|
mod homegrown_cc;
|
||||||
mod imp;
|
mod imp;
|
||||||
|
@ -167,11 +165,3 @@ 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