webrtc: Fix rustfmt errors

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1019>
This commit is contained in:
Zhao, Gang 2022-12-27 10:12:39 +08:00 committed by Sebastian Dröge
parent 877a9bd7f3
commit 9fa838e366
6 changed files with 33 additions and 18 deletions

View file

@ -3,15 +3,15 @@ use std::sync::{Arc, Mutex};
use anyhow::Error;
use tokio::net::{TcpListener, TcpStream};
use tokio::task;
use tokio::time;
use async_tungstenite::tungstenite::Message as WsMessage;
use clap::Parser;
use futures::channel::mpsc;
use futures::prelude::*;
use gst::glib::Type;
use gst::prelude::*;
use tokio::net::{TcpListener, TcpStream};
use tokio::task;
use tokio::time;
use tracing::{debug, info, trace};
use tracing_subscriber::prelude::*;

View file

@ -1,16 +1,16 @@
// SPDX-License-Identifier: MPL-2.0
use tokio::io::AsyncReadExt;
use tokio::task;
use clap::Parser;
use gst_plugin_webrtc_signalling::handlers::Handler;
use gst_plugin_webrtc_signalling::server::Server;
use tokio::io::AsyncReadExt;
use tokio::task;
use tracing_subscriber::prelude::*;
use anyhow::Error;
use tokio_native_tls::native_tls::TlsAcceptor;
use tokio::fs;
use tokio::net::TcpListener;
use tokio_native_tls::native_tls::TlsAcceptor;
use tracing::{info, warn};
#[derive(Parser, Debug)]
@ -67,8 +67,14 @@ async fn main() -> Result<(), Error> {
let mut file = fs::File::open(cert).await?;
let mut identity = vec![];
file.read_to_end(&mut identity).await?;
let identity = tokio_native_tls::native_tls::Identity::from_pkcs12(&identity, args.cert_password.as_deref().unwrap_or("")).unwrap();
Some(tokio_native_tls::TlsAcceptor::from(TlsAcceptor::new(identity).unwrap()))
let identity = tokio_native_tls::native_tls::Identity::from_pkcs12(
&identity,
args.cert_password.as_deref().unwrap_or(""),
)
.unwrap();
Some(tokio_native_tls::TlsAcceptor::from(
TlsAcceptor::new(identity).unwrap(),
))
}
None => None,
};

View file

@ -1,15 +1,15 @@
// SPDX-License-Identifier: MPL-2.0
use anyhow::Error;
use tokio::task;
use async_tungstenite::tungstenite::Message as WsMessage;
use futures::channel::mpsc;
use futures::prelude::*;
use tokio::io::{AsyncRead, AsyncWrite};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::task;
use tracing::{info, instrument, trace, warn};
struct Peer {

View file

@ -1,8 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
use crate::webrtcsink::{RUNTIME, WebRTCSink};
use crate::webrtcsink::{WebRTCSink, RUNTIME};
use anyhow::{anyhow, Error};
use tokio::task;
use async_tungstenite::tungstenite::Message as WsMessage;
use futures::channel::mpsc;
use futures::prelude::*;
@ -15,6 +14,7 @@ use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Mutex;
use tokio::task;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
@ -330,7 +330,12 @@ impl Signaller {
if let Some(handle) = send_task_handle {
if let Err(err) = handle.await {
if let Some(element) = element.upgrade() {
gst::warning!(CAT, obj: element, "Error while joining send task: {}", err);
gst::warning!(
CAT,
obj: element,
"Error while joining send task: {}",
err
);
}
}
}
@ -338,7 +343,12 @@ impl Signaller {
if let Some(handle) = receive_task_handle {
if let Err(err) = handle.await {
if let Some(element) = element.upgrade() {
gst::warning!(CAT, obj: element, "Error while joining receive task: {}", err);
gst::warning!(
CAT,
obj: element,
"Error while joining receive task: {}",
err
);
}
}
}

View file

@ -19,8 +19,8 @@ use std::sync::Mutex;
use super::homegrown_cc::CongestionController;
use super::{WebRTCSinkCongestionControl, WebRTCSinkError, WebRTCSinkMitigationMode};
use crate::webrtcsink::RUNTIME;
use crate::signaller::Signaller;
use crate::webrtcsink::RUNTIME;
use std::collections::BTreeMap;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
@ -1932,8 +1932,7 @@ impl WebRTCSink {
let element_clone = element.downgrade();
let webrtcbin = session.webrtcbin.downgrade();
RUNTIME.spawn(async move {
let mut interval =
tokio::time::interval(std::time::Duration::from_millis(100));
let mut interval = tokio::time::interval(std::time::Duration::from_millis(100));
loop {
interval.tick().await;

View file

@ -9,9 +9,9 @@
use gst::glib;
use gst::prelude::*;
use gst::subclass::prelude::*;
use once_cell::sync::Lazy;
use std::error::Error;
use tokio::runtime;
use once_cell::sync::Lazy;
mod homegrown_cc;
mod imp;