Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
7743a973
提交
7743a973
authored
4月 02, 2022
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary `Clone` implementation for `Box<dyn Transport>`
上级
8448594a
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
13 行增加
和
40 行删除
+13
-40
consumer.rs
rust/src/router/consumer.rs
+2
-2
data_consumer.rs
rust/src/router/data_consumer.rs
+2
-2
data_producer.rs
rust/src/router/data_producer.rs
+2
-2
producer.rs
rust/src/router/producer.rs
+2
-2
transport.rs
rust/src/router/transport.rs
+5
-32
没有找到文件。
rust/src/router/consumer.rs
浏览文件 @
7743a973
...
@@ -374,7 +374,7 @@ struct Inner {
...
@@ -374,7 +374,7 @@ struct Inner {
current_layers
:
Arc
<
Mutex
<
Option
<
ConsumerLayers
>>>
,
current_layers
:
Arc
<
Mutex
<
Option
<
ConsumerLayers
>>>
,
handlers
:
Arc
<
Handlers
>
,
handlers
:
Arc
<
Handlers
>
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
weak_producer
:
WeakProducer
,
weak_producer
:
WeakProducer
,
closed
:
Arc
<
AtomicBool
>
,
closed
:
Arc
<
AtomicBool
>
,
// Drop subscription to consumer-specific notifications when consumer itself is dropped
// Drop subscription to consumer-specific notifications when consumer itself is dropped
...
@@ -480,7 +480,7 @@ impl Consumer {
...
@@ -480,7 +480,7 @@ impl Consumer {
score
:
ConsumerScore
,
score
:
ConsumerScore
,
preferred_layers
:
Option
<
ConsumerLayers
>
,
preferred_layers
:
Option
<
ConsumerLayers
>
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
)
->
Self
{
)
->
Self
{
debug!
(
"new()"
);
debug!
(
"new()"
);
...
...
rust/src/router/data_consumer.rs
浏览文件 @
7743a973
...
@@ -204,7 +204,7 @@ struct Inner {
...
@@ -204,7 +204,7 @@ struct Inner {
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
handlers
:
Arc
<
Handlers
>
,
handlers
:
Arc
<
Handlers
>
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
weak_data_producer
:
WeakDataProducer
,
weak_data_producer
:
WeakDataProducer
,
closed
:
Arc
<
AtomicBool
>
,
closed
:
Arc
<
AtomicBool
>
,
// Drop subscription to consumer-specific notifications when consumer itself is dropped
// Drop subscription to consumer-specific notifications when consumer itself is dropped
...
@@ -364,7 +364,7 @@ impl DataConsumer {
...
@@ -364,7 +364,7 @@ impl DataConsumer {
channel
:
Channel
,
channel
:
Channel
,
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
direct
:
bool
,
direct
:
bool
,
)
->
Self
{
)
->
Self
{
debug!
(
"new()"
);
debug!
(
"new()"
);
...
...
rust/src/router/data_producer.rs
浏览文件 @
7743a973
...
@@ -139,7 +139,7 @@ struct Inner {
...
@@ -139,7 +139,7 @@ struct Inner {
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
handlers
:
Arc
<
Handlers
>
,
handlers
:
Arc
<
Handlers
>
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
closed
:
AtomicBool
,
closed
:
AtomicBool
,
_on_transport_close_handler
:
Mutex
<
HandlerId
>
,
_on_transport_close_handler
:
Mutex
<
HandlerId
>
,
}
}
...
@@ -273,7 +273,7 @@ impl DataProducer {
...
@@ -273,7 +273,7 @@ impl DataProducer {
channel
:
Channel
,
channel
:
Channel
,
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
direct
:
bool
,
direct
:
bool
,
)
->
Self
{
)
->
Self
{
debug!
(
"new()"
);
debug!
(
"new()"
);
...
...
rust/src/router/producer.rs
浏览文件 @
7743a973
...
@@ -302,7 +302,7 @@ struct Inner {
...
@@ -302,7 +302,7 @@ struct Inner {
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
handlers
:
Arc
<
Handlers
>
,
handlers
:
Arc
<
Handlers
>
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
closed
:
AtomicBool
,
closed
:
AtomicBool
,
// Drop subscription to producer-specific notifications when producer itself is dropped
// Drop subscription to producer-specific notifications when producer itself is dropped
subscription_handler
:
Mutex
<
Option
<
SubscriptionHandler
>>
,
subscription_handler
:
Mutex
<
Option
<
SubscriptionHandler
>>
,
...
@@ -460,7 +460,7 @@ impl Producer {
...
@@ -460,7 +460,7 @@ impl Producer {
channel
:
Channel
,
channel
:
Channel
,
payload_channel
:
PayloadChannel
,
payload_channel
:
PayloadChannel
,
app_data
:
AppData
,
app_data
:
AppData
,
transport
:
Box
<
dyn
Transport
>
,
transport
:
Arc
<
dyn
Transport
>
,
direct
:
bool
,
direct
:
bool
,
)
->
Self
{
)
->
Self
{
debug!
(
"new()"
);
debug!
(
"new()"
);
...
...
rust/src/router/transport.rs
浏览文件 @
7743a973
...
@@ -41,27 +41,6 @@ uuid_based_wrapper_type!(
...
@@ -41,27 +41,6 @@ uuid_based_wrapper_type!(
TransportId
TransportId
);
);
// We don't want this to be a public API, but have to use it like this to be able to still use as
// trait object
mod
private
{
use
super
::
Transport
;
#[doc(hidden)]
pub
trait
CloneTransport
{
#[doc(hidden)]
fn
clone_box
(
&
self
)
->
Box
<
dyn
Transport
>
;
}
impl
<
T
>
CloneTransport
for
T
where
T
:
Transport
+
Clone
+
'static
,
{
fn
clone_box
(
&
self
)
->
Box
<
dyn
Transport
>
{
Box
::
new
(
self
.clone
())
}
}
}
/// Data contained in transport trace events.
/// Data contained in transport trace events.
///
///
/// See also "trace" event in the [Debugging](https://mediasoup.org/documentation/v3/mediasoup/debugging#trace-Event)
/// See also "trace" event in the [Debugging](https://mediasoup.org/documentation/v3/mediasoup/debugging#trace-Event)
...
@@ -150,7 +129,7 @@ pub(super) enum TransportType {
...
@@ -150,7 +129,7 @@ pub(super) enum TransportType {
///
///
/// For additional methods see [`TransportGeneric`].
/// For additional methods see [`TransportGeneric`].
#[async_trait]
#[async_trait]
pub
trait
Transport
:
Debug
+
Send
+
Sync
+
private
::
CloneTransport
{
pub
trait
Transport
:
Debug
+
Send
+
Sync
{
/// Transport id.
/// Transport id.
#[must_use]
#[must_use]
fn
id
(
&
self
)
->
TransportId
;
fn
id
(
&
self
)
->
TransportId
;
...
@@ -275,12 +254,6 @@ pub trait Transport: Debug + Send + Sync + private::CloneTransport {
...
@@ -275,12 +254,6 @@ pub trait Transport: Debug + Send + Sync + private::CloneTransport {
fn
on_close
(
&
self
,
callback
:
Box
<
dyn
FnOnce
()
+
Send
+
'static
>
)
->
HandlerId
;
fn
on_close
(
&
self
,
callback
:
Box
<
dyn
FnOnce
()
+
Send
+
'static
>
)
->
HandlerId
;
}
}
impl
Clone
for
Box
<
dyn
Transport
>
{
fn
clone
(
&
self
)
->
Self
{
self
.clone_box
()
}
}
/// Generic transport trait with methods available on all transports in addition to [`Transport`].
/// Generic transport trait with methods available on all transports in addition to [`Transport`].
#[async_trait]
#[async_trait]
pub
trait
TransportGeneric
:
Transport
+
Clone
+
'static
{
pub
trait
TransportGeneric
:
Transport
+
Clone
+
'static
{
...
@@ -553,7 +526,7 @@ pub(super) trait TransportImpl: TransportGeneric {
...
@@ -553,7 +526,7 @@ pub(super) trait TransportImpl: TransportGeneric {
self
.channel
()
.clone
(),
self
.channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
app_data
,
app_data
,
Box
::
new
(
self
.clone
()),
Arc
::
new
(
self
.clone
()),
transport_type
==
TransportType
::
Direct
,
transport_type
==
TransportType
::
Direct
,
);
);
...
@@ -657,7 +630,7 @@ pub(super) trait TransportImpl: TransportGeneric {
...
@@ -657,7 +630,7 @@ pub(super) trait TransportImpl: TransportGeneric {
response
.score
,
response
.score
,
response
.preferred_layers
,
response
.preferred_layers
,
app_data
,
app_data
,
Box
::
new
(
self
.clone
()),
Arc
::
new
(
self
.clone
()),
))
))
}
}
...
@@ -728,7 +701,7 @@ pub(super) trait TransportImpl: TransportGeneric {
...
@@ -728,7 +701,7 @@ pub(super) trait TransportImpl: TransportGeneric {
self
.channel
()
.clone
(),
self
.channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
app_data
,
app_data
,
Box
::
new
(
self
.clone
()),
Arc
::
new
(
self
.clone
()),
transport_type
==
TransportType
::
Direct
,
transport_type
==
TransportType
::
Direct
,
))
))
}
}
...
@@ -818,7 +791,7 @@ pub(super) trait TransportImpl: TransportGeneric {
...
@@ -818,7 +791,7 @@ pub(super) trait TransportImpl: TransportGeneric {
self
.channel
()
.clone
(),
self
.channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
self
.payload_channel
()
.clone
(),
app_data
,
app_data
,
Box
::
new
(
self
.clone
()),
Arc
::
new
(
self
.clone
()),
transport_type
==
TransportType
::
Direct
,
transport_type
==
TransportType
::
Direct
,
);
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论