mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-19 16:46:35 +00:00
net/quinn: Use LazyLock instead of once_cell::Lazy
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1867>
This commit is contained in:
parent
d80c4c4351
commit
850331699a
2 changed files with 11 additions and 13 deletions
|
@ -21,18 +21,17 @@ use gst::{glib, prelude::*, subclass::prelude::*};
|
||||||
use gst_base::prelude::*;
|
use gst_base::prelude::*;
|
||||||
use gst_base::subclass::base_src::CreateSuccess;
|
use gst_base::subclass::base_src::CreateSuccess;
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use quinn::{Connection, ConnectionError, TransportConfig};
|
use quinn::{Connection, ConnectionError, TransportConfig};
|
||||||
use rustls::server;
|
use rustls::server;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::fmt::Error;
|
use std::fmt::Error;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Mutex;
|
use std::sync::{LazyLock, Mutex};
|
||||||
use tokio::net::lookup_host;
|
use tokio::net::lookup_host;
|
||||||
use web_transport_quinn::{ReadError, RecvStream, Session, SessionError, ALPN};
|
use web_transport_quinn::{ReadError, RecvStream, Session, SessionError, ALPN};
|
||||||
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: LazyLock<gst::DebugCategory> = LazyLock::new(|| {
|
||||||
gst::DebugCategory::new(
|
gst::DebugCategory::new(
|
||||||
"quinnwtclientsrc",
|
"quinnwtclientsrc",
|
||||||
gst::DebugColorFlags::empty(),
|
gst::DebugColorFlags::empty(),
|
||||||
|
@ -106,7 +105,7 @@ impl GstObjectImpl for QuinnWebTransportClientSrc {}
|
||||||
|
|
||||||
impl ElementImpl for QuinnWebTransportClientSrc {
|
impl ElementImpl for QuinnWebTransportClientSrc {
|
||||||
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
|
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
|
||||||
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
|
static ELEMENT_METADATA: LazyLock<gst::subclass::ElementMetadata> = LazyLock::new(|| {
|
||||||
gst::subclass::ElementMetadata::new(
|
gst::subclass::ElementMetadata::new(
|
||||||
"Quinn WebTransport Client Source",
|
"Quinn WebTransport Client Source",
|
||||||
"Source/Network/QUIC",
|
"Source/Network/QUIC",
|
||||||
|
@ -118,7 +117,7 @@ impl ElementImpl for QuinnWebTransportClientSrc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: LazyLock<Vec<gst::PadTemplate>> = LazyLock::new(|| {
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
"src",
|
"src",
|
||||||
gst::PadDirection::Src,
|
gst::PadDirection::Src,
|
||||||
|
@ -143,7 +142,7 @@ impl ObjectImpl for QuinnWebTransportClientSrc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: LazyLock<Vec<glib::ParamSpec>> = LazyLock::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::ParamSpecBoxed::builder::<gst::Caps>("caps")
|
glib::ParamSpecBoxed::builder::<gst::Caps>("caps")
|
||||||
.nick("caps")
|
.nick("caps")
|
||||||
|
|
|
@ -20,14 +20,13 @@ use bytes::Bytes;
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use gst::{glib, prelude::*, subclass::prelude::*};
|
use gst::{glib, prelude::*, subclass::prelude::*};
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
use quinn::{Connection, TransportConfig};
|
use quinn::{Connection, TransportConfig};
|
||||||
use web_transport_quinn::{Request, SendStream, Session};
|
use web_transport_quinn::{Request, SendStream, Session};
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Mutex;
|
use std::sync::{LazyLock, Mutex};
|
||||||
|
use web_transport_quinn::{Request, SendStream, Session};
|
||||||
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: LazyLock<gst::DebugCategory> = LazyLock::new(|| {
|
||||||
gst::DebugCategory::new(
|
gst::DebugCategory::new(
|
||||||
"quinnwtserversink",
|
"quinnwtserversink",
|
||||||
gst::DebugColorFlags::empty(),
|
gst::DebugColorFlags::empty(),
|
||||||
|
@ -101,7 +100,7 @@ impl GstObjectImpl for QuinnWebTransportServerSink {}
|
||||||
|
|
||||||
impl ElementImpl for QuinnWebTransportServerSink {
|
impl ElementImpl for QuinnWebTransportServerSink {
|
||||||
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
|
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
|
||||||
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
|
static ELEMENT_METADATA: LazyLock<gst::subclass::ElementMetadata> = LazyLock::new(|| {
|
||||||
gst::subclass::ElementMetadata::new(
|
gst::subclass::ElementMetadata::new(
|
||||||
"Quinn WebTransport Server Sink",
|
"Quinn WebTransport Server Sink",
|
||||||
"Source/Network/WebTransport",
|
"Source/Network/WebTransport",
|
||||||
|
@ -113,7 +112,7 @@ impl ElementImpl for QuinnWebTransportServerSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: LazyLock<Vec<gst::PadTemplate>> = LazyLock::new(|| {
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
gst::PadDirection::Sink,
|
gst::PadDirection::Sink,
|
||||||
|
@ -157,7 +156,7 @@ impl ObjectImpl for QuinnWebTransportServerSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: LazyLock<Vec<glib::ParamSpec>> = LazyLock::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::ParamSpecString::builder("server-name")
|
glib::ParamSpecString::builder("server-name")
|
||||||
.nick("QUIC server name")
|
.nick("QUIC server name")
|
||||||
|
|
Loading…
Reference in a new issue