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
f5187e8b
Commit
f5187e8b
authored
Jan 20, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化GOP相关逻辑
parent
f4536686
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
12 行增加
和
9 行删除
+12
-9
3rdpart/ZLToolKit
+1
-1
src/Rtmp/RtmpMediaSource.h
+3
-2
src/Rtmp/RtmpMediaSourceImp.h
+1
-1
src/Rtsp/RtspMediaSource.h
+4
-4
src/Rtsp/RtspMediaSourceImp.h
+1
-1
src/Rtsp/RtspPlayerImp.h
+2
-0
没有找到文件。
ZLToolKit
@
8eaecbd6
Subproject commit
3850c1adcc5d184c6da0dd263ac011388bb2ffee
Subproject commit
8eaecbd6dd8bed0bee6a61168255653127a20a43
src/Rtmp/RtmpMediaSource.h
查看文件 @
f5187e8b
...
...
@@ -46,6 +46,7 @@
#include "Thread/ThreadPool.h"
using
namespace
toolkit
;
#define RTMP_GOP_SIZE 512
namespace
mediakit
{
/**
...
...
@@ -70,7 +71,7 @@ public:
RtmpMediaSource
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
stream_id
,
int
ring_size
=
0
)
:
int
ring_size
=
RTMP_GOP_SIZE
)
:
MediaSource
(
RTMP_SCHEMA
,
vhost
,
app
,
stream_id
),
_ring_size
(
ring_size
)
{
}
...
...
@@ -146,7 +147,7 @@ public:
//rtmp包缓存最大允许512个,如果是纯视频(25fps)大概为20秒数据
//但是这个是GOP缓存的上限值,真实的GOP缓存大小等于两个I帧之间的包数的两倍
//而且每次遇到I帧,则会清空GOP缓存,所以真实的GOP缓存远小于此值
_ring
=
std
::
make_shared
<
RingType
>
(
_ring_size
,
512
,
std
::
move
(
lam
));
_ring
=
std
::
make_shared
<
RingType
>
(
_ring_size
,
std
::
move
(
lam
));
onReaderChanged
(
0
);
if
(
_metadata
){
...
...
src/Rtmp/RtmpMediaSourceImp.h
查看文件 @
f5187e8b
...
...
@@ -54,7 +54,7 @@ public:
* @param id 流id
* @param ringSize 环形缓存大小
*/
RtmpMediaSourceImp
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
id
,
int
ringSize
=
0
)
:
RtmpMediaSource
(
vhost
,
app
,
id
,
ringSize
)
{
RtmpMediaSourceImp
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
id
,
int
ringSize
=
RTMP_GOP_SIZE
)
:
RtmpMediaSource
(
vhost
,
app
,
id
,
ringSize
)
{
_demuxer
=
std
::
make_shared
<
RtmpDemuxer
>
();
_demuxer
->
setTrackListener
(
this
);
}
...
...
src/Rtsp/RtspMediaSource.h
查看文件 @
f5187e8b
...
...
@@ -35,17 +35,17 @@
#include "Common/config.h"
#include "Common/MediaSource.h"
#include "RtpCodec.h"
#include "Util/logger.h"
#include "Util/RingBuffer.h"
#include "Util/TimeTicker.h"
#include "Util/ResourcePool.h"
#include "Util/NoticeCenter.h"
#include "Thread/ThreadPool.h"
using
namespace
std
;
using
namespace
toolkit
;
#define RTP_GOP_SIZE 2048
namespace
mediakit
{
/**
...
...
@@ -70,7 +70,7 @@ public:
RtspMediaSource
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
stream_id
,
int
ring_size
=
0
)
:
int
ring_size
=
RTP_GOP_SIZE
)
:
MediaSource
(
RTSP_SCHEMA
,
vhost
,
app
,
stream_id
),
_ring_size
(
ring_size
)
{}
virtual
~
RtspMediaSource
()
{}
...
...
@@ -182,7 +182,7 @@ public:
//rtp包缓存最大允许2048个,大概最多3MB数据
//但是这个是GOP缓存的上限值,真实的GOP缓存大小等于两个I帧之间的包数的两倍
//而且每次遇到I帧,则会清空GOP缓存,所以真实的GOP缓存远小于此值
_ring
=
std
::
make_shared
<
RingType
>
(
_ring_size
,
2048
,
std
::
move
(
lam
));
_ring
=
std
::
make_shared
<
RingType
>
(
_ring_size
,
std
::
move
(
lam
));
onReaderChanged
(
0
);
if
(
!
_sdp
.
empty
())
{
regist
();
...
...
src/Rtsp/RtspMediaSourceImp.h
查看文件 @
f5187e8b
...
...
@@ -45,7 +45,7 @@ public:
* @param id 流id
* @param ringSize 环形缓存大小
*/
RtspMediaSourceImp
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
id
,
int
ringSize
=
0
)
:
RtspMediaSource
(
vhost
,
app
,
id
,
ringSize
)
{
RtspMediaSourceImp
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
id
,
int
ringSize
=
RTP_GOP_SIZE
)
:
RtspMediaSource
(
vhost
,
app
,
id
,
ringSize
)
{
_demuxer
=
std
::
make_shared
<
RtspDemuxer
>
();
_demuxer
->
setTrackListener
(
this
);
}
...
...
src/Rtsp/RtspPlayerImp.h
查看文件 @
f5187e8b
...
...
@@ -72,6 +72,8 @@ private:
}
void
onRecvRTP
(
const
RtpPacket
::
Ptr
&
rtp
,
const
SdpTrack
::
Ptr
&
track
)
override
{
if
(
_pRtspMediaSrc
){
// rtsp直接代理是无法判断该rtp是否是I帧,所以GOP缓存基本是无效的
// 为了减少内存使用,那么我们设置为一直关键帧以便清空GOP缓存
_pRtspMediaSrc
->
onWrite
(
rtp
,
true
);
}
_delegate
->
inputRtp
(
rtp
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论