Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
336c398e
提交
336c398e
authored
8月 28, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace `Bytes` with simple `Vec<u8>`
上级
7b5c6341
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
25 行增加
和
41 行删除
+25
-41
Cargo.toml
rust/Cargo.toml
+0
-1
direct_data.rs
rust/benches/direct_data.rs
+2
-5
data_structures.rs
rust/src/data_structures.rs
+6
-7
consumer.rs
rust/src/router/consumer.rs
+2
-3
direct_transport.rs
rust/src/router/direct_transport.rs
+3
-4
producer.rs
rust/src/router/producer.rs
+1
-2
channel.rs
rust/src/worker/channel.rs
+4
-8
payload_channel.rs
rust/src/worker/payload_channel.rs
+6
-9
direct_transport.rs
rust/tests/integration/direct_transport.rs
+1
-2
没有找到文件。
rust/Cargo.toml
浏览文件 @
336c398e
...
@@ -26,7 +26,6 @@ async-io = "1.6.0"
...
@@ -26,7 +26,6 @@ async-io = "1.6.0"
async-lock
=
"2.4.0"
async-lock
=
"2.4.0"
async-oneshot
=
"0.5.0"
async-oneshot
=
"0.5.0"
async-trait
=
"0.1.50"
async-trait
=
"0.1.50"
bytes
=
"1.0.1"
event-listener-primitives
=
"1.0.0"
event-listener-primitives
=
"1.0.0"
fastrand
=
"1.5.0"
fastrand
=
"1.5.0"
futures-lite
=
"1.12.0"
futures-lite
=
"1.12.0"
...
...
rust/benches/direct_data.rs
浏览文件 @
336c398e
use
bytes
::
Bytes
;
use
criterion
::
async_executor
::
FuturesExecutor
;
use
criterion
::
async_executor
::
FuturesExecutor
;
use
criterion
::{
criterion_group
,
criterion_main
,
Criterion
};
use
criterion
::{
criterion_group
,
criterion_main
,
Criterion
};
use
futures_lite
::
StreamExt
;
use
futures_lite
::
StreamExt
;
...
@@ -29,11 +28,9 @@ async fn create_data_producer_consumer_pair(
...
@@ -29,11 +28,9 @@ async fn create_data_producer_consumer_pair(
pub
fn
criterion_benchmark
(
c
:
&
mut
Criterion
)
{
pub
fn
criterion_benchmark
(
c
:
&
mut
Criterion
)
{
let
mut
group
=
c
.benchmark_group
(
"direct_data"
);
let
mut
group
=
c
.benchmark_group
(
"direct_data"
);
let
data
=
Bytes
::
from
(
let
data
=
std
::
iter
::
repeat_with
(||
fastrand
::
u8
(
..
))
std
::
iter
::
repeat_with
(||
fastrand
::
u8
(
..
))
.take
(
512
)
.take
(
512
)
.collect
::
<
Vec
<
u8
>>
(),
.collect
::
<
Vec
<
u8
>>
();
);
{
{
let
(
data_producer
,
_data_consumer
)
=
futures_lite
::
future
::
block_on
(
async
{
let
(
data_producer
,
_data_consumer
)
=
futures_lite
::
future
::
block_on
(
async
{
...
...
rust/src/data_structures.rs
浏览文件 @
336c398e
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
#[cfg(test)]
#[cfg(test)]
mod
tests
;
mod
tests
;
use
bytes
::
Bytes
;
use
serde
::
de
::{
MapAccess
,
Visitor
};
use
serde
::
de
::{
MapAccess
,
Visitor
};
use
serde
::
ser
::
SerializeStruct
;
use
serde
::
ser
::
SerializeStruct
;
use
serde
::{
de
,
Deserialize
,
Deserializer
,
Serialize
,
Serializer
};
use
serde
::{
de
,
Deserialize
,
Deserializer
,
Serialize
,
Serializer
};
...
@@ -774,7 +773,7 @@ pub enum WebRtcMessage {
...
@@ -774,7 +773,7 @@ pub enum WebRtcMessage {
/// String
/// String
String
(
String
),
String
(
String
),
/// Binary
/// Binary
Binary
(
Bytes
),
Binary
(
Vec
<
u8
>
),
/// EmptyString
/// EmptyString
EmptyString
,
EmptyString
,
/// EmptyBinary
/// EmptyBinary
...
@@ -793,7 +792,7 @@ impl WebRtcMessage {
...
@@ -793,7 +792,7 @@ impl WebRtcMessage {
// | WebRTC Binary Empty | 57 |
// | WebRTC Binary Empty | 57 |
// +------------------------------------+-----------+
// +------------------------------------+-----------+
pub
(
crate
)
fn
new
(
ppid
:
u32
,
payload
:
Bytes
)
->
Result
<
Self
,
u32
>
{
pub
(
crate
)
fn
new
(
ppid
:
u32
,
payload
:
Vec
<
u8
>
)
->
Result
<
Self
,
u32
>
{
match
ppid
{
match
ppid
{
51
=>
Ok
(
WebRtcMessage
::
String
(
51
=>
Ok
(
WebRtcMessage
::
String
(
String
::
from_utf8
(
payload
.to_vec
())
.unwrap
(),
String
::
from_utf8
(
payload
.to_vec
())
.unwrap
(),
...
@@ -805,12 +804,12 @@ impl WebRtcMessage {
...
@@ -805,12 +804,12 @@ impl WebRtcMessage {
}
}
}
}
pub
(
crate
)
fn
into_ppid_and_payload
(
self
)
->
(
u32
,
Bytes
)
{
pub
(
crate
)
fn
into_ppid_and_payload
(
self
)
->
(
u32
,
Vec
<
u8
>
)
{
match
self
{
match
self
{
WebRtcMessage
::
String
(
string
)
=>
(
51
_u32
,
Bytes
::
from
(
string
)),
WebRtcMessage
::
String
(
string
)
=>
(
51
_u32
,
string
.into_bytes
(
)),
WebRtcMessage
::
Binary
(
binary
)
=>
(
53
_u32
,
binary
),
WebRtcMessage
::
Binary
(
binary
)
=>
(
53
_u32
,
binary
),
WebRtcMessage
::
EmptyString
=>
(
56
_u32
,
Bytes
::
from_static
(
b
" "
)),
WebRtcMessage
::
EmptyString
=>
(
56
_u32
,
Vec
::
from
(
b
" "
.as_ref
()
)),
WebRtcMessage
::
EmptyBinary
=>
(
57
_u32
,
Bytes
::
from
(
vec!
[
0
_u8
])
),
WebRtcMessage
::
EmptyBinary
=>
(
57
_u32
,
vec!
[
0
_u8
]
),
}
}
}
}
}
}
...
...
rust/src/router/consumer.rs
浏览文件 @
336c398e
...
@@ -17,7 +17,6 @@ use crate::worker::{
...
@@ -17,7 +17,6 @@ use crate::worker::{
Channel
,
NotificationMessage
,
PayloadChannel
,
RequestError
,
SubscriptionHandler
,
Channel
,
NotificationMessage
,
PayloadChannel
,
RequestError
,
SubscriptionHandler
,
};
};
use
async_executor
::
Executor
;
use
async_executor
::
Executor
;
use
bytes
::
Bytes
;
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
log
::{
debug
,
error
};
use
log
::{
debug
,
error
};
use
parking_lot
::
Mutex
;
use
parking_lot
::
Mutex
;
...
@@ -347,7 +346,7 @@ enum PayloadNotification {
...
@@ -347,7 +346,7 @@ enum PayloadNotification {
#[derive(Default)]
#[derive(Default)]
struct
Handlers
{
struct
Handlers
{
rtp
:
Bag
<
Box
<
dyn
Fn
(
&
Bytes
)
+
Send
+
Sync
>>
,
rtp
:
Bag
<
Box
<
dyn
Fn
(
&
Vec
<
u8
>
)
+
Send
+
Sync
>>
,
pause
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
pause
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
resume
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
resume
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
producer_pause
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
producer_pause
:
Bag
<
Box
<
dyn
Fn
()
+
Send
+
Sync
>>
,
...
@@ -868,7 +867,7 @@ impl Consumer {
...
@@ -868,7 +867,7 @@ impl Consumer {
/// # Notes on usage
/// # Notes on usage
/// Just available in direct transports, this is, those created via
/// Just available in direct transports, this is, those created via
/// [`Router::create_direct_transport`](crate::router::Router::create_direct_transport).
/// [`Router::create_direct_transport`](crate::router::Router::create_direct_transport).
pub
fn
on_rtp
<
F
:
Fn
(
&
Bytes
)
+
Send
+
Sync
+
'static
>
(
&
self
,
callback
:
F
)
->
HandlerId
{
pub
fn
on_rtp
<
F
:
Fn
(
&
Vec
<
u8
>
)
+
Send
+
Sync
+
'static
>
(
&
self
,
callback
:
F
)
->
HandlerId
{
self
.inner.handlers.rtp
.add
(
Box
::
new
(
callback
))
self
.inner.handlers.rtp
.add
(
Box
::
new
(
callback
))
}
}
...
...
rust/src/router/direct_transport.rs
浏览文件 @
336c398e
...
@@ -21,7 +21,6 @@ use crate::worker::{
...
@@ -21,7 +21,6 @@ use crate::worker::{
};
};
use
async_executor
::
Executor
;
use
async_executor
::
Executor
;
use
async_trait
::
async_trait
;
use
async_trait
::
async_trait
;
use
bytes
::
Bytes
;
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
log
::{
debug
,
error
};
use
log
::{
debug
,
error
};
use
parking_lot
::
Mutex
;
use
parking_lot
::
Mutex
;
...
@@ -113,7 +112,7 @@ pub struct DirectTransportStat {
...
@@ -113,7 +112,7 @@ pub struct DirectTransportStat {
#[derive(Default)]
#[derive(Default)]
struct
Handlers
{
struct
Handlers
{
rtcp
:
Bag
<
Box
<
dyn
Fn
(
&
Bytes
)
+
Send
+
Sync
>>
,
rtcp
:
Bag
<
Box
<
dyn
Fn
(
&
Vec
<
u8
>
)
+
Send
+
Sync
>>
,
new_producer
:
Bag
<
Box
<
dyn
Fn
(
&
Producer
)
+
Send
+
Sync
>>
,
new_producer
:
Bag
<
Box
<
dyn
Fn
(
&
Producer
)
+
Send
+
Sync
>>
,
new_consumer
:
Bag
<
Box
<
dyn
Fn
(
&
Consumer
)
+
Send
+
Sync
>>
,
new_consumer
:
Bag
<
Box
<
dyn
Fn
(
&
Consumer
)
+
Send
+
Sync
>>
,
new_data_producer
:
Bag
<
Box
<
dyn
Fn
(
&
DataProducer
)
+
Send
+
Sync
>>
,
new_data_producer
:
Bag
<
Box
<
dyn
Fn
(
&
DataProducer
)
+
Send
+
Sync
>>
,
...
@@ -537,7 +536,7 @@ impl DirectTransport {
...
@@ -537,7 +536,7 @@ impl DirectTransport {
/// Send a RTCP packet from the Rust process.
/// Send a RTCP packet from the Rust process.
///
///
/// * `rtcp_packet` - Bytes containing a valid RTCP packet (can be a compound packet).
/// * `rtcp_packet` - Bytes containing a valid RTCP packet (can be a compound packet).
pub
async
fn
send_rtcp
(
&
self
,
rtcp_packet
:
Bytes
)
->
Result
<
(),
NotificationError
>
{
pub
async
fn
send_rtcp
(
&
self
,
rtcp_packet
:
Vec
<
u8
>
)
->
Result
<
(),
NotificationError
>
{
self
.inner
self
.inner
.payload_channel
.payload_channel
.notify
(
.notify
(
...
@@ -550,7 +549,7 @@ impl DirectTransport {
...
@@ -550,7 +549,7 @@ impl DirectTransport {
}
}
/// Callback is called when the direct transport receives a RTCP packet from its router.
/// Callback is called when the direct transport receives a RTCP packet from its router.
pub
fn
on_rtcp
<
F
:
Fn
(
&
Bytes
)
+
Send
+
Sync
+
'static
>
(
&
self
,
callback
:
F
)
->
HandlerId
{
pub
fn
on_rtcp
<
F
:
Fn
(
&
Vec
<
u8
>
)
+
Send
+
Sync
+
'static
>
(
&
self
,
callback
:
F
)
->
HandlerId
{
self
.inner.handlers.rtcp
.add
(
Box
::
new
(
callback
))
self
.inner.handlers.rtcp
.add
(
Box
::
new
(
callback
))
}
}
...
...
rust/src/router/producer.rs
浏览文件 @
336c398e
...
@@ -16,7 +16,6 @@ use crate::worker::{
...
@@ -16,7 +16,6 @@ use crate::worker::{
Channel
,
NotificationError
,
PayloadChannel
,
RequestError
,
SubscriptionHandler
,
Channel
,
NotificationError
,
PayloadChannel
,
RequestError
,
SubscriptionHandler
,
};
};
use
async_executor
::
Executor
;
use
async_executor
::
Executor
;
use
bytes
::
Bytes
;
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
event_listener_primitives
::{
Bag
,
BagOnce
,
HandlerId
};
use
log
::{
debug
,
error
};
use
log
::{
debug
,
error
};
use
parking_lot
::
Mutex
;
use
parking_lot
::
Mutex
;
...
@@ -766,7 +765,7 @@ impl Producer {
...
@@ -766,7 +765,7 @@ impl Producer {
impl
DirectProducer
{
impl
DirectProducer
{
/// Sends a RTP packet from the Rust process.
/// Sends a RTP packet from the Rust process.
pub
async
fn
send
(
&
self
,
rtp_packet
:
Bytes
)
->
Result
<
(),
NotificationError
>
{
pub
async
fn
send
(
&
self
,
rtp_packet
:
Vec
<
u8
>
)
->
Result
<
(),
NotificationError
>
{
self
.inner
self
.inner
.payload_channel
.payload_channel
.notify
(
.notify
(
...
...
rust/src/worker/channel.rs
浏览文件 @
336c398e
...
@@ -3,7 +3,6 @@ use crate::worker::common::{EventHandlers, SubscriptionTarget, WeakEventHandlers
...
@@ -3,7 +3,6 @@ use crate::worker::common::{EventHandlers, SubscriptionTarget, WeakEventHandlers
use
crate
::
worker
::
utils
;
use
crate
::
worker
::
utils
;
use
crate
::
worker
::
utils
::{
PreparedChannelRead
,
PreparedChannelWrite
};
use
crate
::
worker
::
utils
::{
PreparedChannelRead
,
PreparedChannelWrite
};
use
crate
::
worker
::{
RequestError
,
SubscriptionHandler
};
use
crate
::
worker
::{
RequestError
,
SubscriptionHandler
};
use
bytes
::
Bytes
;
use
futures_lite
::
future
;
use
futures_lite
::
future
;
use
log
::{
debug
,
error
,
trace
,
warn
};
use
log
::{
debug
,
error
,
trace
,
warn
};
use
lru
::
LruCache
;
use
lru
::
LruCache
;
...
@@ -282,7 +281,6 @@ impl Channel {
...
@@ -282,7 +281,6 @@ impl Channel {
}
}
}
}
// TODO: Replace `Bytes` with simple `Vec<u8>`
pub
(
crate
)
async
fn
request
<
R
>
(
&
self
,
request
:
R
)
->
Result
<
R
::
Response
,
RequestError
>
pub
(
crate
)
async
fn
request
<
R
>
(
&
self
,
request
:
R
)
->
Result
<
R
::
Response
,
RequestError
>
where
where
R
:
Request
,
R
:
Request
,
...
@@ -318,16 +316,14 @@ impl Channel {
...
@@ -318,16 +316,14 @@ impl Channel {
debug!
(
"request() [method:{}, id:{}]: {:?}"
,
method
,
id
,
request
);
debug!
(
"request() [method:{}, id:{}]: {:?}"
,
method
,
id
,
request
);
let
bytes
=
Bytes
::
from
(
let
message
=
serde_json
::
to_vec
(
&
RequestMessagePrivate
{
serde_json
::
to_vec
(
&
RequestMessagePrivate
{
id
,
id
,
method
,
method
,
request
:
&
request
,
request
:
&
request
,
})
})
.unwrap
(),
.unwrap
();
);
if
bytes
.len
()
>
PAYLOAD_MAX_LEN
{
if
message
.len
()
>
PAYLOAD_MAX_LEN
{
self
.inner
self
.inner
.requests_container_weak
.requests_container_weak
.upgrade
()
.upgrade
()
...
@@ -340,7 +336,7 @@ impl Channel {
...
@@ -340,7 +336,7 @@ impl Channel {
{
{
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
outgoing_message_buffer
.messages
.push_back
(
bytes
.to_vec
()
);
outgoing_message_buffer
.messages
.push_back
(
message
);
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
unsafe
{
unsafe
{
// Notify worker that there is something to read
// Notify worker that there is something to read
...
...
rust/src/worker/payload_channel.rs
浏览文件 @
336c398e
...
@@ -2,7 +2,6 @@ use crate::messages::{Notification, Request};
...
@@ -2,7 +2,6 @@ use crate::messages::{Notification, Request};
use
crate
::
worker
::
common
::{
EventHandlers
,
SubscriptionTarget
,
WeakEventHandlers
};
use
crate
::
worker
::
common
::{
EventHandlers
,
SubscriptionTarget
,
WeakEventHandlers
};
use
crate
::
worker
::
utils
::{
PreparedPayloadChannelRead
,
PreparedPayloadChannelWrite
};
use
crate
::
worker
::
utils
::{
PreparedPayloadChannelRead
,
PreparedPayloadChannelWrite
};
use
crate
::
worker
::{
utils
,
RequestError
,
SubscriptionHandler
};
use
crate
::
worker
::{
utils
,
RequestError
,
SubscriptionHandler
};
use
bytes
::
Bytes
;
use
futures_lite
::
future
;
use
futures_lite
::
future
;
use
log
::{
debug
,
error
,
trace
,
warn
};
use
log
::{
debug
,
error
,
trace
,
warn
};
use
mediasoup_sys
::
UvAsyncT
;
use
mediasoup_sys
::
UvAsyncT
;
...
@@ -26,7 +25,7 @@ pub(super) enum InternalMessage {
...
@@ -26,7 +25,7 @@ pub(super) enum InternalMessage {
#[derive(Clone)]
#[derive(Clone)]
pub
(
crate
)
struct
NotificationMessage
{
pub
(
crate
)
struct
NotificationMessage
{
pub
(
crate
)
message
:
Value
,
pub
(
crate
)
message
:
Value
,
pub
(
crate
)
payload
:
Bytes
,
pub
(
crate
)
payload
:
Vec
<
u8
>
,
}
}
#[derive(Debug,
Deserialize)]
#[derive(Debug,
Deserialize)]
...
@@ -180,7 +179,7 @@ impl PayloadChannel {
...
@@ -180,7 +179,7 @@ impl PayloadChannel {
trace!
(
"received notification payload of {} bytes"
,
payload
.len
());
trace!
(
"received notification payload of {} bytes"
,
payload
.len
());
let
payload
=
Bytes
::
copy_from_slice
(
payload
);
let
payload
=
Vec
::
from
(
payload
);
if
let
Some
(
target_id
)
=
target_id
{
if
let
Some
(
target_id
)
=
target_id
{
event_handlers
.call_callbacks_with_value
(
event_handlers
.call_callbacks_with_value
(
...
@@ -227,11 +226,10 @@ impl PayloadChannel {
...
@@ -227,11 +226,10 @@ impl PayloadChannel {
self
.inner.internal_message_receiver
.clone
()
self
.inner.internal_message_receiver
.clone
()
}
}
// TODO: Replace `Bytes` with simple `Vec<u8>`
pub
(
crate
)
async
fn
request
<
R
>
(
pub
(
crate
)
async
fn
request
<
R
>
(
&
self
,
&
self
,
request
:
R
,
request
:
R
,
payload
:
Bytes
,
payload
:
Vec
<
u8
>
,
)
->
Result
<
R
::
Response
,
RequestError
>
)
->
Result
<
R
::
Response
,
RequestError
>
where
where
R
:
Request
,
R
:
Request
,
...
@@ -289,7 +287,7 @@ impl PayloadChannel {
...
@@ -289,7 +287,7 @@ impl PayloadChannel {
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
outgoing_message_buffer
outgoing_message_buffer
.messages
.messages
.push_back
((
message
,
payload
.to_vec
()
));
.push_back
((
message
,
payload
));
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
unsafe
{
unsafe
{
// Notify worker that there is something to read
// Notify worker that there is something to read
...
@@ -343,11 +341,10 @@ impl PayloadChannel {
...
@@ -343,11 +341,10 @@ impl PayloadChannel {
})
})
}
}
// TODO: Replace `Bytes` with simple `Vec<u8>`
pub
(
crate
)
async
fn
notify
<
N
>
(
pub
(
crate
)
async
fn
notify
<
N
>
(
&
self
,
&
self
,
notification
:
N
,
notification
:
N
,
payload
:
Bytes
,
payload
:
Vec
<
u8
>
,
)
->
Result
<
(),
NotificationError
>
)
->
Result
<
(),
NotificationError
>
where
where
N
:
Notification
,
N
:
Notification
,
...
@@ -375,7 +372,7 @@ impl PayloadChannel {
...
@@ -375,7 +372,7 @@ impl PayloadChannel {
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
let
mut
outgoing_message_buffer
=
self
.inner.outgoing_message_buffer
.lock
();
outgoing_message_buffer
outgoing_message_buffer
.messages
.messages
.push_back
((
message
,
payload
.to_vec
()
));
.push_back
((
message
,
payload
));
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
if
let
Some
(
handle
)
=
&
outgoing_message_buffer
.handle
{
unsafe
{
unsafe
{
// Notify worker that there is something to read
// Notify worker that there is something to read
...
...
rust/tests/integration/direct_transport.rs
浏览文件 @
336c398e
use
bytes
::
Bytes
;
use
futures_lite
::
future
;
use
futures_lite
::
future
;
use
mediasoup
::
data_consumer
::
DataConsumerOptions
;
use
mediasoup
::
data_consumer
::
DataConsumerOptions
;
use
mediasoup
::
data_producer
::{
DataProducer
,
DataProducerOptions
};
use
mediasoup
::
data_producer
::{
DataProducer
,
DataProducerOptions
};
...
@@ -240,7 +239,7 @@ fn send_succeeds() {
...
@@ -240,7 +239,7 @@ fn send_succeeds() {
sent_message_bytes
+=
content
.len
();
sent_message_bytes
+=
content
.len
();
WebRtcMessage
::
String
(
content
)
WebRtcMessage
::
String
(
content
)
}
else
{
}
else
{
let
content
=
Bytes
::
from
(
id
.to_string
()
.into_bytes
()
);
let
content
=
id
.to_string
()
.into_bytes
(
);
sent_message_bytes
+=
content
.len
();
sent_message_bytes
+=
content
.len
();
WebRtcMessage
::
Binary
(
content
)
WebRtcMessage
::
Binary
(
content
)
};
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论