Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
a205383b
提交
a205383b
authored
9月 21, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cosmetic improvements in Consumer.cpp/.hpp
上级
64f1335d
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
39 行增加
和
44 行删除
+39
-44
Consumer.hpp
worker/include/RTC/Consumer.hpp
+6
-7
Consumer.cpp
worker/src/RTC/Consumer.cpp
+33
-37
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
a205383b
...
@@ -94,13 +94,12 @@ namespace RTC
...
@@ -94,13 +94,12 @@ namespace RTC
RTC
::
RtpDataCounter
transmittedCounter
;
RTC
::
RtpDataCounter
transmittedCounter
;
RTC
::
RtpDataCounter
retransmittedCounter
;
RTC
::
RtpDataCounter
retransmittedCounter
;
// RTP sequence number and timestamp.
// RTP sequence number and timestamp.
uint16_t
seqNum
{
0
};
uint16_t
rtpLastSeq
{
0
};
uint16_t
seqNumBase
{
0
};
uint16_t
rtpBaseSeq
{
0
};
uint16_t
seqNumPreviousBase
{
0
};
uint16_t
rtpPreviousBaseSeq
{
0
};
uint32_t
rtpTimestamp
{
0
};
uint32_t
rtpLastTimestamp
{
0
};
uint32_t
rtpTimestampBase
{
0
};
uint32_t
rtpBaseTimestamp
{
0
};
uint32_t
rtpTimestampPreviousBase
{
0
};
uint32_t
rtpPreviousBaseTimestamp
{
0
};
uint32_t
lastReceivedSsrc
{
0
};
bool
syncRequired
{
true
};
bool
syncRequired
{
true
};
// RTP profiles.
// RTP profiles.
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
profiles
;
std
::
set
<
RTC
::
RtpEncodingParameters
::
Profile
>
profiles
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
a205383b
...
@@ -24,11 +24,11 @@ namespace RTC
...
@@ -24,11 +24,11 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Initialize sequence number.
// Initialize
RTP
sequence number.
this
->
seqNum
=
static_cast
<
uint16_t
>
(
Utils
::
Crypto
::
GetRandomUInt
(
0x00FF
,
0xFFFF
));
this
->
rtpLastSeq
=
static_cast
<
uint16_t
>
(
Utils
::
Crypto
::
GetRandomUInt
(
0x00FF
,
0xFFFF
));
// Initialize RTP timestamp.
// Initialize RTP timestamp.
this
->
rtpTimestamp
=
Utils
::
Crypto
::
GetRandomUInt
(
0x00FF
,
0xFFFF
);
this
->
rtp
Last
Timestamp
=
Utils
::
Crypto
::
GetRandomUInt
(
0x00FF
,
0xFFFF
);
// Set the RTCP report generation interval.
// Set the RTCP report generation interval.
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
AUDIO
)
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
AUDIO
)
...
@@ -351,66 +351,63 @@ namespace RTC
...
@@ -351,66 +351,63 @@ namespace RTC
{
{
isSyncPacket
=
true
;
isSyncPacket
=
true
;
this
->
seqNumPreviousBase
=
this
->
seqNum
;
this
->
rtpPreviousBaseSeq
=
this
->
rtpLastSeq
;
this
->
seqNumBase
=
packet
->
GetSequenceNumber
();
this
->
rtpBaseSeq
=
packet
->
GetSequenceNumber
();
this
->
rtp
TimestampPreviousBase
=
this
->
rtp
Timestamp
;
this
->
rtp
PreviousBaseTimestamp
=
this
->
rtpLast
Timestamp
;
this
->
rtp
TimestampBase
=
packet
->
GetTimestamp
();
this
->
rtp
BaseTimestamp
=
packet
->
GetTimestamp
();
this
->
syncRequired
=
false
;
this
->
syncRequired
=
false
;
MS_DEBUG_TAG
(
rtp
,
"re-syncing Consumer stream [seqNum:%"
PRIu16
"]"
,
this
->
seqNum
);
MS_DEBUG_TAG
(
rtp
,
"re-syncing Consumer stream [rtpLastSeq:%"
PRIu16
"]"
,
this
->
rtpLastSeq
);
}
else
{
MS_ASSERT
(
this
->
lastReceivedSsrc
==
packet
->
GetSsrc
(),
"new SSRC requires re-syncing"
);
}
}
if
(
isSyncPacket
)
if
(
isSyncPacket
)
{
{
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
rtp
,
"before re-syncing [
seqNum:%"
PRIu16
", rtp
Timestamp:%"
PRIu32
"]"
,
"before re-syncing [
rtpLastSeq:%"
PRIu16
", rtpLast
Timestamp:%"
PRIu32
"]"
,
this
->
seqNum
,
this
->
rtpLastSeq
,
this
->
rtpTimestamp
);
this
->
rtp
Last
Timestamp
);
}
}
this
->
rtpTimestamp
=
// Calculate latest RTP seq number to be sent.
(
packet
->
GetTimestamp
()
-
this
->
rtpTimestampBase
)
+
this
->
rtpTimestampPreviousBase
+
1
;
this
->
rtpLastSeq
=
packet
->
GetSequenceNumber
()
-
this
->
rtpBaseSeq
+
this
->
rtpPreviousBaseSeq
+
1
;
this
->
seqNum
=
(
packet
->
GetSequenceNumber
()
-
this
->
seqNumBase
)
+
this
->
seqNumPreviousBase
+
1
;
// Calculate latest RTP timestamp to be sent.
this
->
rtpLastTimestamp
=
packet
->
GetTimestamp
()
-
this
->
rtpBaseTimestamp
+
this
->
rtpPreviousBaseTimestamp
+
1
;
// Save the received SSRC.
// Save the received SSRC.
this
->
lastReceived
Ssrc
=
packet
->
GetSsrc
();
auto
orig
Ssrc
=
packet
->
GetSsrc
();
// Save the received sequence number.
// Save the received sequence number.
auto
seqNum
=
packet
->
GetSequenceNumber
();
auto
origSeq
=
packet
->
GetSequenceNumber
();
// Save the received timestamp.
// Save the received timestamp.
auto
rtp
Timestamp
=
packet
->
GetTimestamp
();
auto
orig
Timestamp
=
packet
->
GetTimestamp
();
// Rewrite packet SSRC.
// Rewrite packet SSRC.
packet
->
SetSsrc
(
this
->
rtpParameters
.
encodings
[
0
].
ssrc
);
packet
->
SetSsrc
(
this
->
rtpParameters
.
encodings
[
0
].
ssrc
);
// Rewrite packet sequence number.
// Rewrite packet sequence number.
packet
->
SetSequenceNumber
(
this
->
seqNum
);
packet
->
SetSequenceNumber
(
this
->
rtpLastSeq
);
// Rewrite packet timestamp.
// Rewrite packet timestamp.
packet
->
SetTimestamp
(
this
->
rtpTimestamp
);
packet
->
SetTimestamp
(
this
->
rtp
Last
Timestamp
);
if
(
isSyncPacket
)
if
(
isSyncPacket
)
{
{
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
rtp
,
rtp
,
"sending sync packet [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
"sending sync packet [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
"
] from original [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
", profile:%s
]"
,
"
, profile:%s] from original [seq:%"
PRIu16
", ts:%"
PRIu32
"
]"
,
packet
->
GetSsrc
(),
packet
->
GetSsrc
(),
packet
->
GetSequenceNumber
(),
packet
->
GetSequenceNumber
(),
packet
->
GetTimestamp
(),
packet
->
GetTimestamp
(),
this
->
lastReceivedSsrc
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
(),
seqNum
,
origSeq
,
rtpTimestamp
,
origTimestamp
);
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
}
}
// Process the packet.
// Process the packet.
...
@@ -424,27 +421,26 @@ namespace RTC
...
@@ -424,27 +421,26 @@ namespace RTC
}
}
else
else
{
{
MS_
DEBUG
_TAG
(
MS_
WARN
_TAG
(
rtp
,
rtp
,
"failed to send packet [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
"failed to send packet [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
"
], from original [ssrc:%"
PRIu32
", seq:%"
PRIu16
", ts:%"
PRIu32
", profile:%s
]"
,
"
, profile:%s] from original [seq:%"
PRIu16
", ts:%"
PRIu32
"
]"
,
packet
->
GetSsrc
(),
packet
->
GetSsrc
(),
packet
->
GetSequenceNumber
(),
packet
->
GetSequenceNumber
(),
packet
->
GetTimestamp
(),
packet
->
GetTimestamp
(),
this
->
lastReceivedSsrc
,
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
(),
seqNum
,
origSeq
,
rtpTimestamp
,
origTimestamp
);
RTC
::
RtpEncodingParameters
::
profile2String
[
profile
].
c_str
());
}
}
// Restore packet SSRC.
// Restore packet SSRC.
packet
->
SetSsrc
(
this
->
lastReceived
Ssrc
);
packet
->
SetSsrc
(
orig
Ssrc
);
// Restore the original sequence number.
// Restore the original sequence number.
packet
->
SetSequenceNumber
(
seqNum
);
packet
->
SetSequenceNumber
(
origSeq
);
// Restore the original timestamp.
// Restore the original timestamp.
packet
->
SetTimestamp
(
rtp
Timestamp
);
packet
->
SetTimestamp
(
orig
Timestamp
);
}
}
void
Consumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
void
Consumer
::
GetRtcp
(
RTC
::
RTCP
::
CompoundPacket
*
packet
,
uint64_t
now
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论