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
e7e8969b
Commit
e7e8969b
authored
Aug 08, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ps解析添加外部缓存
parent
30bbbd2e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
6 行删除
+22
-6
src/Rtp/RtpProcess.cpp
+17
-5
src/Rtp/RtpProcess.h
+5
-1
没有找到文件。
src/Rtp/RtpProcess.cpp
查看文件 @
e7e8969b
...
...
@@ -111,7 +111,7 @@ static inline bool checkTS(const uint8_t *packet, int bytes){
}
void
RtpProcess
::
onRtpSorted
(
const
RtpPacket
::
Ptr
&
rtp
,
int
)
{
if
(
rtp
->
sequence
!=
_sequence
+
(
uint16_t
)
1
&&
_sequence
!=
0
){
if
(
rtp
->
sequence
!=
(
uint16_t
)(
_sequence
+
1
)
&&
_sequence
!=
0
){
WarnP
(
this
)
<<
"rtp丢包:"
<<
rtp
->
sequence
<<
" != "
<<
_sequence
<<
"+1"
<<
",公网环境下请使用tcp方式推流"
;
}
_sequence
=
rtp
->
sequence
;
...
...
@@ -124,6 +124,21 @@ void RtpProcess::onRtpSorted(const RtpPacket::Ptr &rtp, int) {
decodeRtp
(
rtp
->
data
()
+
4
,
rtp
->
size
()
-
4
);
}
const
char
*
RtpProcess
::
onSearchPacketTail
(
const
char
*
packet
,
int
bytes
){
try
{
auto
ret
=
_decoder
->
input
((
uint8_t
*
)
packet
,
bytes
);
if
(
ret
>
0
)
{
return
packet
+
ret
;
}
return
nullptr
;
}
catch
(
std
::
exception
&
ex
)
{
InfoL
<<
"解析ps或ts异常: bytes="
<<
bytes
<<
" ,exception="
<<
ex
.
what
()
<<
" ,hex="
<<
hexdump
((
uint8_t
*
)
packet
,
bytes
);
return
nullptr
;
}
}
void
RtpProcess
::
onRtpDecode
(
const
uint8_t
*
packet
,
int
bytes
,
uint32_t
timestamp
,
int
flags
)
{
if
(
_save_file_ps
){
fwrite
((
uint8_t
*
)
packet
,
bytes
,
1
,
_save_file_ps
.
get
());
...
...
@@ -143,10 +158,7 @@ void RtpProcess::onRtpDecode(const uint8_t *packet, int bytes, uint32_t timestam
}
if
(
_decoder
)
{
auto
ret
=
_decoder
->
input
((
uint8_t
*
)
packet
,
bytes
);
if
(
ret
!=
bytes
)
{
WarnP
(
this
)
<<
ret
<<
" != "
<<
bytes
<<
" "
<<
flags
;
}
HttpRequestSplitter
::
input
((
char
*
)
packet
,
bytes
);
}
}
...
...
src/Rtp/RtpProcess.h
查看文件 @
e7e8969b
...
...
@@ -18,11 +18,12 @@
#include "Decoder.h"
#include "Common/Device.h"
#include "Common/Stamp.h"
#include "Http/HttpRequestSplitter.h"
using
namespace
mediakit
;
namespace
mediakit
{
class
RtpProcess
:
public
RtpReceiver
,
public
RtpDecoder
,
public
SockInfo
,
public
MediaSinkInterface
,
public
std
::
enable_shared_from_this
<
RtpProcess
>
{
class
RtpProcess
:
public
HttpRequestSplitter
,
public
RtpReceiver
,
public
RtpDecoder
,
public
SockInfo
,
public
MediaSinkInterface
,
public
std
::
enable_shared_from_this
<
RtpProcess
>
{
public
:
typedef
std
::
shared_ptr
<
RtpProcess
>
Ptr
;
RtpProcess
(
const
string
&
stream_id
);
...
...
@@ -71,6 +72,9 @@ protected:
void
addTrack
(
const
Track
::
Ptr
&
track
)
override
;
void
resetTracks
()
override
{};
const
char
*
onSearchPacketTail
(
const
char
*
data
,
int
len
)
override
;
int64_t
onRecvHeader
(
const
char
*
data
,
uint64_t
len
)
override
{
return
0
;
};
private
:
void
emitOnPublish
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论