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:
Sanchayan Maity 2024-11-27 18:31:45 +05:30 committed by GStreamer Marge Bot
parent d80c4c4351
commit 850331699a
2 changed files with 11 additions and 13 deletions

View file

@ -21,18 +21,17 @@ use gst::{glib, prelude::*, subclass::prelude::*};
use gst_base::prelude::*;
use gst_base::subclass::base_src::CreateSuccess;
use gst_base::subclass::prelude::*;
use once_cell::sync::Lazy;
use quinn::{Connection, ConnectionError, TransportConfig};
use rustls::server;
use std::borrow::Borrow;
use std::fmt::Error;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::path::PathBuf;
use std::sync::Mutex;
use std::sync::{LazyLock, Mutex};
use tokio::net::lookup_host;
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(
"quinnwtclientsrc",
gst::DebugColorFlags::empty(),
@ -106,7 +105,7 @@ impl GstObjectImpl for QuinnWebTransportClientSrc {}
impl ElementImpl for QuinnWebTransportClientSrc {
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(
"Quinn WebTransport Client Source",
"Source/Network/QUIC",
@ -118,7 +117,7 @@ impl ElementImpl for QuinnWebTransportClientSrc {
}
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(
"src",
gst::PadDirection::Src,
@ -143,7 +142,7 @@ impl ObjectImpl for QuinnWebTransportClientSrc {
}
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
static PROPERTIES: LazyLock<Vec<glib::ParamSpec>> = LazyLock::new(|| {
vec![
glib::ParamSpecBoxed::builder::<gst::Caps>("caps")
.nick("caps")

View file

@ -20,14 +20,13 @@ use bytes::Bytes;
use futures::future;
use gst::{glib, prelude::*, subclass::prelude::*};
use gst_base::subclass::prelude::*;
use once_cell::sync::Lazy;
use quinn::{Connection, TransportConfig};
use web_transport_quinn::{Request, SendStream, Session};
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(
"quinnwtserversink",
gst::DebugColorFlags::empty(),
@ -101,7 +100,7 @@ impl GstObjectImpl for QuinnWebTransportServerSink {}
impl ElementImpl for QuinnWebTransportServerSink {
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(
"Quinn WebTransport Server Sink",
"Source/Network/WebTransport",
@ -113,7 +112,7 @@ impl ElementImpl for QuinnWebTransportServerSink {
}
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(
"sink",
gst::PadDirection::Sink,
@ -157,7 +156,7 @@ impl ObjectImpl for QuinnWebTransportServerSink {
}
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
static PROPERTIES: LazyLock<Vec<glib::ParamSpec>> = LazyLock::new(|| {
vec![
glib::ParamSpecString::builder("server-name")
.nick("QUIC server name")