Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
6ecc3ebe
提交
6ecc3ebe
authored
3月 31, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RTX: just resend a RTP packet if not already resent in the last RTT ms.
上级
f5182d25
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
33 行增加
和
16 行删除
+33
-16
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+32
-16
没有找到文件。
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
6ecc3ebe
...
...
@@ -22,6 +22,7 @@ namespace RTC
struct
BufferItem
{
uint32_t
seq32
=
0
;
// RTP seq in 32 bytes plus 16 bits cycles.
uint64_t
resent_at_time
=
0
;
RTC
::
RtpPacket
*
packet
=
nullptr
;
};
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
6ecc3ebe
...
...
@@ -7,7 +7,8 @@
#include "Utils.hpp"
#define RTP_SEQ_MOD (1<<16)
#define MAX_RETRANSMISSION_AGE 300 // Don't retransmit packets older than this (ms).
#define MAX_RETRANSMISSION_AGE 1000 // Don't retransmit packets older than this (ms).
#define DEFAULT_RTT 100 // Default RTT if not set (in ms).
namespace
RTC
{
...
...
@@ -143,7 +144,7 @@ namespace RTC
// Try again.
if
(
first_seq32
>
buffer_last_seq32
||
last_seq32
<
buffer_first_seq32
)
{
MS_
DEBUG_DEV
(
"requested packet range not in the buffer"
);
MS_
WARN_TAG
(
rtx
,
"requested packet range not in the buffer"
);
return
;
}
...
...
@@ -151,13 +152,15 @@ namespace RTC
// Otherwise just return.
else
{
MS_
DEBUG_DEV
(
"requested packet range not in the buffer"
);
MS_
WARN_TAG
(
rtx
,
"requested packet range not in the buffer"
);
return
;
}
}
// Look for each requested packet.
uint64_t
now
=
DepLibUV
::
GetTime
();
uint32_t
rtt
=
(
this
->
rtt
?
this
->
rtt
:
DEFAULT_RTT
);
uint32_t
seq32
=
first_seq32
;
bool
requested
=
true
;
size_t
container_idx
=
0
;
...
...
@@ -168,7 +171,6 @@ namespace RTC
bool
is_first_packet
=
true
;
bool
first_packet_sent
=
false
;
uint8_t
bitmask_counter
=
0
;
bool
too_old_packet_found
=
false
;
MS_DEBUG_DEV
(
"loop [bitmask:"
MS_UINT16_TO_BINARY_PATTERN
"]"
,
MS_UINT16_TO_BINARY
(
bitmask
));
...
...
@@ -189,30 +191,44 @@ namespace RTC
uint32_t
diff
=
(
this
->
max_timestamp
-
current_packet
->
GetTimestamp
())
*
1000
/
this
->
params
.
clockRate
;
// Just provide the packet if no older than MAX_RETRANSMISSION_AGE ms.
if
(
diff
<=
MAX_RETRANSMISSION_AGE
)
if
(
diff
>
MAX_RETRANSMISSION_AGE
)
{
// Store the packet in the container and then increment its index.
container
[
container_idx
++
]
=
current_packet
;
MS_DEBUG_TAG
(
rtx
,
"ignoring retransmission for too old packet [max_age:%"
PRIu32
"ms, packet_age:%"
PRIu32
"ms]"
,
MAX_RETRANSMISSION_AGE
,
diff
);
sent
=
true
;
if
(
is_first_packet
)
first_packet_sent
=
true
;
break
;
}
else
if
(
!
too_old_packet_found
)
// Don't resent the packet if it was resent in the last RTT ms.
uint32_t
resent_at_time
=
(
*
buffer_it
).
resent_at_time
;
if
(
resent_at_time
&&
now
-
resent_at_time
<
static_cast
<
uint64_t
>
(
rtt
))
{
MS_DEBUG_DEV
(
"ignoring retransmission for too old packet [max_age:%"
PRIu32
"ms, packet_age:%"
PRIu32
"ms]"
,
MAX_RETRANSMISSION_AGE
,
diff
);
MS_DEBUG_TAG
(
rtx
,
"ignoring retransmission for a packet already resent in the last RTT ms [rtt:%"
PRIu32
"]"
,
rtt
);
too_old_packet_found
=
true
;
break
;
}
// Exit the loop.
// Store the packet in the container and then increment its index.
container
[
container_idx
++
]
=
current_packet
;
// Save when this packet was resent.
(
*
buffer_it
).
resent_at_time
=
now
;
sent
=
true
;
if
(
is_first_packet
)
first_packet_sent
=
true
;
break
;
}
// It can not be after this packet.
else
if
(
current_seq32
>
seq32
)
{
// Exit the loop.
break
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论