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
1dc5eed7
Commit
1dc5eed7
authored
Sep 14, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化性能
parent
492d083f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
4 行增加
和
61 行删除
+4
-61
src/Common/MediaSender.h
+0
-45
src/Rtmp/RtmpMediaSource.h
+2
-8
src/Rtsp/RtspMediaSource.h
+2
-8
没有找到文件。
src/Common/MediaSender.h
deleted
100644 → 0
查看文件 @
492d083f
/*
* MIT License
*
* Copyright (c) 2016 xiongziliang <771730766@qq.com>
*
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SRC_MEDIASENDER_H_
#define SRC_MEDIASENDER_H_
#include "Thread/ThreadPool.h"
using
namespace
ZL
::
Thread
;
class
MediaSender
{
public
:
static
ThreadPool
&
sendThread
()
{
static
ThreadPool
pool
(
1
,
ThreadPool
::
PRIORITY_HIGHEST
);
return
pool
;
}
private
:
MediaSender
();
virtual
~
MediaSender
();
};
#endif
/* SRC_MEDIASENDER_H_ */
src/Rtmp/RtmpMediaSource.h
查看文件 @
1dc5eed7
...
...
@@ -36,7 +36,6 @@
#include "Rtmp.h"
#include "RtmpParser.h"
#include "Common/config.h"
#include "Common/MediaSender.h"
#include "Common/MediaSource.h"
#include "Util/util.h"
#include "Util/logger.h"
...
...
@@ -61,8 +60,7 @@ public:
RtmpMediaSource
(
const
string
&
vhost
,
const
string
&
strApp
,
const
string
&
strId
)
:
MediaSource
(
RTMP_SCHEMA
,
vhost
,
strApp
,
strId
),
m_pRing
(
new
RingBuffer
<
RtmpPacket
::
Ptr
>
()),
m_thPool
(
MediaSender
::
sendThread
())
{
m_pRing
(
new
RingBuffer
<
RtmpPacket
::
Ptr
>
())
{
}
virtual
~
RtmpMediaSource
()
{}
...
...
@@ -109,10 +107,7 @@ public:
}
}
auto
_ring
=
m_pRing
;
m_thPool
.
async
([
_ring
,
pkt
]()
{
_ring
->
write
(
pkt
,
pkt
->
isVideoKeyFrame
());
});
m_pRing
->
write
(
pkt
,
pkt
->
isVideoKeyFrame
());
}
private
:
bool
ready
(){
...
...
@@ -124,7 +119,6 @@ protected:
unordered_map
<
int
,
RtmpPacket
::
Ptr
>
m_mapCfgFrame
;
mutable
recursive_mutex
m_mtxMap
;
RingBuffer
<
RtmpPacket
::
Ptr
>::
Ptr
m_pRing
;
//rtp环形缓冲
ThreadPool
&
m_thPool
;
int
m_iCfgFrameSize
=
-
1
;
bool
m_bAsyncRegist
=
false
;
bool
m_bRegisted
=
false
;
...
...
src/Rtsp/RtspMediaSource.h
查看文件 @
1dc5eed7
...
...
@@ -34,7 +34,6 @@
#include <unordered_map>
#include "Rtsp.h"
#include "Common/config.h"
#include "Common/MediaSender.h"
#include "Common/MediaSource.h"
#include "Util/logger.h"
...
...
@@ -60,8 +59,7 @@ public:
RtspMediaSource
(
const
string
&
strVhost
,
const
string
&
strApp
,
const
string
&
strId
)
:
MediaSource
(
RTSP_SCHEMA
,
strVhost
,
strApp
,
strId
),
m_pRing
(
new
RingBuffer
<
RtpPacket
::
Ptr
>
()),
m_thPool
(
MediaSender
::
sendThread
())
{
m_pRing
(
new
RingBuffer
<
RtpPacket
::
Ptr
>
())
{
}
virtual
~
RtspMediaSource
()
{}
...
...
@@ -95,16 +93,12 @@ public:
trackRef
.
timeStamp
=
rtppt
->
timeStamp
;
trackRef
.
ssrc
=
rtppt
->
ssrc
;
trackRef
.
type
=
rtppt
->
type
;
auto
_outRing
=
m_pRing
;
m_thPool
.
async
([
_outRing
,
rtppt
,
keyPos
]()
{
_outRing
->
write
(
rtppt
,
keyPos
);
});
m_pRing
->
write
(
rtppt
,
keyPos
);
}
protected
:
unordered_map
<
int
,
RtspTrack
>
m_mapTracks
;
string
m_strSdp
;
//媒体描述信息
RingType
::
Ptr
m_pRing
;
//rtp环形缓冲
ThreadPool
&
m_thPool
;
};
}
/* namespace Rtsp */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论