Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
9fc534d8
Commit
9fc534d8
authored
Apr 11, 2019
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化rtp排序逻辑,处理seq回环的情况
parent
dee4f031
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
11 行删除
+17
-11
3rdpart/ZLToolKit
+1
-1
src/Rtsp/RtpReceiver.cpp
+14
-8
src/Rtsp/RtpReceiver.h
+2
-2
没有找到文件。
ZLToolKit
@
942e9bb1
Subproject commit
c713905a73ba1a86e9978a43e29a3e3d5e6bf77e
Subproject commit
942e9bb1eb38285c78fcfef9d7468f249b4d36e4
src/Rtsp/RtpReceiver.cpp
查看文件 @
9fc534d8
...
...
@@ -81,7 +81,7 @@ bool RtpReceiver::handleOneRtp(int iTrackidx,SdpTrack::Ptr &track, unsigned char
rtppt
.
payload
[
0
]
=
'$'
;
rtppt
.
payload
[
1
]
=
rtppt
.
interleaved
;
rtppt
.
payload
[
2
]
=
(
uiLen
&
0xFF00
)
>>
8
;
rtppt
.
payload
[
2
]
=
uiLen
>>
8
;
rtppt
.
payload
[
3
]
=
(
uiLen
&
0x00FF
);
rtppt
.
offset
=
16
;
...
...
@@ -100,14 +100,20 @@ bool RtpReceiver::handleOneRtp(int iTrackidx,SdpTrack::Ptr &track, unsigned char
memcpy
(
rtppt
.
payload
+
4
,
pucData
,
uiLen
);
/////////////////////////////////RTP排序逻辑///////////////////////////////////
if
(
rtppt
.
sequence
!=
(
uint16_t
)(
_aui16LastSeq
[
iTrackidx
]
+
1
)
&&
_aui16LastSeq
[
iTrackidx
]
!=
0
){
if
(
rtppt
.
sequence
!=
_aui16LastSeq
[
iTrackidx
]
+
1
&&
_aui16LastSeq
[
iTrackidx
]
!=
0
){
//包乱序或丢包
_aui
64
SeqOkCnt
[
iTrackidx
]
=
0
;
_aui
32
SeqOkCnt
[
iTrackidx
]
=
0
;
_abSortStarted
[
iTrackidx
]
=
true
;
//WarnL << "包乱序或丢包:" << trackidx <<" " << rtppt.sequence << " " << _aui16LastSeq[trackidx];
if
(
_aui16LastSeq
[
iTrackidx
]
>
rtppt
.
sequence
&&
_aui16LastSeq
[
iTrackidx
]
-
rtppt
.
sequence
>
0x7FFF
){
//sequence回环,清空所有排序缓存
while
(
_amapRtpSort
[
iTrackidx
].
size
())
{
POP_HEAD
(
iTrackidx
)
}
}
}
else
{
//正确序列的包
_aui
64
SeqOkCnt
[
iTrackidx
]
++
;
_aui
32
SeqOkCnt
[
iTrackidx
]
++
;
}
_aui16LastSeq
[
iTrackidx
]
=
rtppt
.
sequence
;
...
...
@@ -116,9 +122,9 @@ bool RtpReceiver::handleOneRtp(int iTrackidx,SdpTrack::Ptr &track, unsigned char
_amapRtpSort
[
iTrackidx
].
emplace
(
rtppt
.
sequence
,
pt_ptr
);
GET_CONFIG_AND_REGISTER
(
uint32_t
,
clearCount
,
Rtp
::
kClearCount
);
GET_CONFIG_AND_REGISTER
(
uint32_t
,
maxRtpCount
,
Rtp
::
kMaxRtpCount
);
if
(
_aui
64
SeqOkCnt
[
iTrackidx
]
>=
clearCount
)
{
if
(
_aui
32
SeqOkCnt
[
iTrackidx
]
>=
clearCount
)
{
//网络环境改善,需要清空排序缓存
_aui
64
SeqOkCnt
[
iTrackidx
]
=
0
;
_aui
32
SeqOkCnt
[
iTrackidx
]
=
0
;
_abSortStarted
[
iTrackidx
]
=
false
;
while
(
_amapRtpSort
[
iTrackidx
].
size
())
{
POP_HEAD
(
iTrackidx
)
...
...
@@ -138,7 +144,7 @@ bool RtpReceiver::handleOneRtp(int iTrackidx,SdpTrack::Ptr &track, unsigned char
void
RtpReceiver
::
clear
()
{
CLEAR_ARR
(
_aui16LastSeq
)
CLEAR_ARR
(
_aui32SsrcErrorCnt
)
CLEAR_ARR
(
_aui
64
SeqOkCnt
)
CLEAR_ARR
(
_aui
32
SeqOkCnt
)
CLEAR_ARR
(
_abSortStarted
)
_amapRtpSort
[
0
].
clear
();
...
...
src/Rtsp/RtpReceiver.h
查看文件 @
9fc534d8
...
...
@@ -68,9 +68,9 @@ private:
uint32_t
_aui32SsrcErrorCnt
[
2
]
=
{
0
,
0
};
/* RTP包排序所用参数 */
uint16_t
_aui16LastSeq
[
2
]
=
{
0
,
0
};
uint
64_t
_aui64
SeqOkCnt
[
2
]
=
{
0
,
0
};
uint
32_t
_aui32
SeqOkCnt
[
2
]
=
{
0
,
0
};
bool
_abSortStarted
[
2
]
=
{
0
,
0
};
map
<
uint
32
_t
,
RtpPacket
::
Ptr
>
_amapRtpSort
[
2
];
map
<
uint
16
_t
,
RtpPacket
::
Ptr
>
_amapRtpSort
[
2
];
RtspMediaSource
::
PoolType
_pktPool
;
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论