Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
6c1402fd
提交
6c1402fd
authored
9月 26, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use SeqManager when needed
上级
ffb4b514
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
55 行删除
+22
-55
VP8.hpp
worker/include/RTC/Codecs/VP8.hpp
+4
-7
Consumer.hpp
worker/include/RTC/Consumer.hpp
+3
-6
VP8.cpp
worker/src/RTC/Codecs/VP8.cpp
+6
-13
Consumer.cpp
worker/src/RTC/Consumer.cpp
+9
-29
没有找到文件。
worker/include/RTC/Codecs/VP8.hpp
浏览文件 @
6c1402fd
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/Codecs/PayloadDescriptorHandler.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/SeqManager.hpp"
/* RFC 7741
/* RFC 7741
* VP8 Payload Descriptor
* VP8 Payload Descriptor
...
@@ -42,7 +43,7 @@ namespace RTC
...
@@ -42,7 +43,7 @@ namespace RTC
~
PayloadDescriptor
()
=
default
;
~
PayloadDescriptor
()
=
default
;
void
Dump
()
const
;
void
Dump
()
const
;
// Rewrite the buffer with the given pictureId and tl0Pic
ut
reIndex values.
// Rewrite the buffer with the given pictureId and tl0Pic
tu
reIndex values.
void
Encode
(
uint8_t
*
data
,
uint16_t
pictureId
,
uint8_t
tl0PictureIndex
);
void
Encode
(
uint8_t
*
data
,
uint16_t
pictureId
,
uint8_t
tl0PictureIndex
);
void
Restore
(
uint8_t
*
data
);
void
Restore
(
uint8_t
*
data
);
...
@@ -78,12 +79,8 @@ namespace RTC
...
@@ -78,12 +79,8 @@ namespace RTC
void
SyncRequired
()
override
;
void
SyncRequired
()
override
;
public
:
public
:
uint16_t
pictureId
{
0
};
SeqManager
<
uint16_t
>
pictureIdManager
;
uint16_t
pictureIdBase
{
0
};
SeqManager
<
uint8_t
>
tl0PictureIndexManager
;
uint16_t
pictureIdPreviousBase
{
0
};
uint8_t
tl0PictureIndex
{
0
};
uint8_t
tl0PictureIndexBase
{
0
};
uint8_t
tl0PictureIndexPreviousBase
{
0
};
bool
syncRequired
{
false
};
bool
syncRequired
{
false
};
};
};
...
...
worker/include/RTC/Consumer.hpp
浏览文件 @
6c1402fd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpStreamSend.hpp"
#include "RTC/RtpStreamSend.hpp"
#include "RTC/SeqManager.hpp"
#include "RTC/Transport.hpp"
#include "RTC/Transport.hpp"
#include <json/json.h>
#include <json/json.h>
#include <set>
#include <set>
...
@@ -95,12 +96,8 @@ namespace RTC
...
@@ -95,12 +96,8 @@ 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
rtpLastSeq
{
0
};
RTC
::
SeqManager
<
uint16_t
>
rtpSeqManager
;
uint16_t
rtpBaseSeq
{
0
};
RTC
::
SeqManager
<
uint32_t
>
rtpTimestampManager
;
uint16_t
rtpPreviousBaseSeq
{
0
};
uint32_t
rtpLastTimestamp
{
0
};
uint32_t
rtpBaseTimestamp
{
0
};
uint32_t
rtpPreviousBaseTimestamp
{
0
};
bool
syncRequired
{
true
};
bool
syncRequired
{
true
};
std
::
unique_ptr
<
RTC
::
Codecs
::
EncodingContext
>
encodingContext
;
std
::
unique_ptr
<
RTC
::
Codecs
::
EncodingContext
>
encodingContext
;
...
...
worker/src/RTC/Codecs/VP8.cpp
浏览文件 @
6c1402fd
...
@@ -165,25 +165,18 @@ namespace RTC
...
@@ -165,25 +165,18 @@ namespace RTC
// Check whether pictureId and tl0PictureIndex sync is required.
// Check whether pictureId and tl0PictureIndex sync is required.
if
(
context
->
syncRequired
)
if
(
context
->
syncRequired
)
{
{
context
->
pictureIdPreviousBase
=
context
->
pictureId
;
context
->
pictureIdManager
.
Sync
(
this
->
payloadDescriptor
->
pictureId
);
context
->
pictureIdBase
=
this
->
payloadDescriptor
->
pictureId
;
context
->
tl0PictureIndexManager
.
Sync
(
this
->
payloadDescriptor
->
tl0PictureIndex
);
context
->
tl0PictureIndexPreviousBase
=
context
->
tl0PictureIndex
;
context
->
tl0PictureIndexBase
=
this
->
payloadDescriptor
->
tl0PictureIndex
;
context
->
syncRequired
=
false
;
context
->
syncRequired
=
false
;
}
}
// Update pictureId and tl0PictureIndex values.
// Update pictureId and tl0PictureIndex values.
context
->
pictureId
=
(
this
->
payloadDescriptor
->
pictureId
-
context
->
pictureIdBase
)
+
uint16_t
pictureId
;
context
->
pictureIdPreviousBase
+
1
;
uint8_t
tl0PictureIndex
;
context
->
tl0PictureIndex
=
(
this
->
payloadDescriptor
->
tl0PictureIndex
-
context
->
tl0PictureIndexBase
)
+
context
->
tl0PictureIndexPreviousBase
+
1
;
auto
pictureId
=
context
->
pictureId
;
context
->
pictureIdManager
.
Input
(
this
->
payloadDescriptor
->
pictureId
,
pictureId
)
;
auto
tl0PictureIndex
=
context
->
tl0PictureIndex
;
context
->
tl0PictureIndexManager
.
Input
(
this
->
payloadDescriptor
->
tl0PictureIndex
,
tl0PictureIndex
)
;
this
->
payloadDescriptor
->
Encode
(
data
,
pictureId
,
tl0PictureIndex
);
this
->
payloadDescriptor
->
Encode
(
data
,
pictureId
,
tl0PictureIndex
);
};
};
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
6c1402fd
...
@@ -24,12 +24,6 @@ namespace RTC
...
@@ -24,12 +24,6 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Initialize RTP sequence number.
this
->
rtpLastSeq
=
static_cast
<
uint16_t
>
(
Utils
::
Crypto
::
GetRandomUInt
(
0x00FF
,
0xFFFF
));
// Initialize RTP timestamp.
this
->
rtpLastTimestamp
=
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
)
this
->
maxRtcpInterval
=
RTC
::
RTCP
::
MaxAudioIntervalMs
;
this
->
maxRtcpInterval
=
RTC
::
RTCP
::
MaxAudioIntervalMs
;
...
@@ -351,35 +345,21 @@ namespace RTC
...
@@ -351,35 +345,21 @@ namespace RTC
{
{
isSyncPacket
=
true
;
isSyncPacket
=
true
;
this
->
rtpPreviousBaseSeq
=
this
->
rtpLastSeq
;
this
->
rtpSeqManager
.
Sync
(
packet
->
GetSequenceNumber
());
this
->
rtpBaseSeq
=
packet
->
GetSequenceNumber
();
this
->
rtpTimestampManager
.
Sync
(
packet
->
GetTimestamp
());
this
->
rtpPreviousBaseTimestamp
=
this
->
rtpLastTimestamp
;
this
->
rtpBaseTimestamp
=
packet
->
GetTimestamp
();
this
->
syncRequired
=
false
;
this
->
syncRequired
=
false
;
if
(
this
->
encodingContext
)
if
(
this
->
encodingContext
)
this
->
encodingContext
->
SyncRequired
();
this
->
encodingContext
->
SyncRequired
();
MS_DEBUG_TAG
(
rtp
,
"re-syncing Consumer stream [rtpLastSeq:%"
PRIu16
"]"
,
this
->
rtpLastSeq
);
}
if
(
isSyncPacket
)
{
MS_DEBUG_TAG
(
rtp
,
"before re-syncing [rtpLastSeq:%"
PRIu16
", rtpLastTimestamp:%"
PRIu32
"]"
,
this
->
rtpLastSeq
,
this
->
rtpLastTimestamp
);
}
}
// Calculate latest RTP seq number to be sent.
// Update RTP seq number and timestamp.
this
->
rtpLastSeq
=
packet
->
GetSequenceNumber
()
-
this
->
rtpBaseSeq
+
this
->
rtpPreviousBaseSeq
+
1
;
uint16_t
rtpSeq
;
uint32_t
rtpTimestamp
;
// Calculate latest RTP timestamp to be sent.
this
->
rtpSeqManager
.
Input
(
packet
->
GetSequenceNumber
(),
rtpSeq
);
this
->
rtpLastTimestamp
=
this
->
rtpTimestampManager
.
Input
(
packet
->
GetTimestamp
(),
rtpTimestamp
);
packet
->
GetTimestamp
()
-
this
->
rtpBaseTimestamp
+
this
->
rtpPreviousBaseTimestamp
+
1
;
// Save the received SSRC.
// Save the received SSRC.
auto
origSsrc
=
packet
->
GetSsrc
();
auto
origSsrc
=
packet
->
GetSsrc
();
...
@@ -394,10 +374,10 @@ namespace RTC
...
@@ -394,10 +374,10 @@ namespace RTC
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
->
rtpLast
Seq
);
packet
->
SetSequenceNumber
(
rtp
Seq
);
// Rewrite packet timestamp.
// Rewrite packet timestamp.
packet
->
SetTimestamp
(
this
->
rtpLast
Timestamp
);
packet
->
SetTimestamp
(
rtp
Timestamp
);
// Rewrite payload if needed.
// Rewrite payload if needed.
if
(
this
->
encodingContext
)
if
(
this
->
encodingContext
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论