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
00c21cd9
Commit
00c21cd9
authored
Apr 23, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
eda7a59f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
11 行删除
+10
-11
src/Http/HttpSession.cpp
+0
-1
src/Rtsp/RtspPlayer.cpp
+10
-10
没有找到文件。
src/Http/HttpSession.cpp
查看文件 @
00c21cd9
...
@@ -520,7 +520,6 @@ bool HttpSession::emitHttpEvent(bool doInvoke){
...
@@ -520,7 +520,6 @@ bool HttpSession::emitHttpEvent(bool doInvoke){
};
};
///////////////////广播HTTP事件///////////////////////////
///////////////////广播HTTP事件///////////////////////////
bool
consumed
=
false
;
//该事件是否被消费
bool
consumed
=
false
;
//该事件是否被消费
TcpSession
&
session
=
static_cast
<
TcpSession
&>
(
*
this
);
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastHttpRequest
,
_parser
,
invoker
,
consumed
,
static_cast
<
SockInfo
&>
(
*
this
));
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastHttpRequest
,
_parser
,
invoker
,
consumed
,
static_cast
<
SockInfo
&>
(
*
this
));
if
(
!
consumed
&&
doInvoke
){
if
(
!
consumed
&&
doInvoke
){
//该事件无人消费,所以返回404
//该事件无人消费,所以返回404
...
...
src/Rtsp/RtspPlayer.cpp
查看文件 @
00c21cd9
...
@@ -119,10 +119,12 @@ void RtspPlayer::onRecv(const Buffer::Ptr& pBuf) {
...
@@ -119,10 +119,12 @@ void RtspPlayer::onRecv(const Buffer::Ptr& pBuf) {
}
}
input
(
pBuf
->
data
(),
pBuf
->
size
());
input
(
pBuf
->
data
(),
pBuf
->
size
());
}
}
void
RtspPlayer
::
onErr
(
const
SockException
&
ex
)
{
void
RtspPlayer
::
onErr
(
const
SockException
&
ex
)
{
//定时器_pPlayTimer为空后表明握手结束了
//定时器_pPlayTimer为空后表明握手结束了
onPlayResult_l
(
ex
,
!
_pPlayTimer
);
onPlayResult_l
(
ex
,
!
_pPlayTimer
);
}
}
// from live555
// from live555
bool
RtspPlayer
::
handleAuthenticationFailure
(
const
string
&
paramsStr
)
{
bool
RtspPlayer
::
handleAuthenticationFailure
(
const
string
&
paramsStr
)
{
if
(
!
_rtspRealm
.
empty
()){
if
(
!
_rtspRealm
.
empty
()){
...
@@ -155,6 +157,7 @@ bool RtspPlayer::handleAuthenticationFailure(const string ¶msStr) {
...
@@ -155,6 +157,7 @@ bool RtspPlayer::handleAuthenticationFailure(const string ¶msStr) {
}
}
return
false
;
return
false
;
}
}
void
RtspPlayer
::
handleResDESCRIBE
(
const
Parser
&
parser
)
{
void
RtspPlayer
::
handleResDESCRIBE
(
const
Parser
&
parser
)
{
string
authInfo
=
parser
[
"WWW-Authenticate"
];
string
authInfo
=
parser
[
"WWW-Authenticate"
];
//发送DESCRIBE命令后的回复
//发送DESCRIBE命令后的回复
...
@@ -237,7 +240,6 @@ void RtspPlayer::createUdpSockIfNecessary(int track_idx){
...
@@ -237,7 +240,6 @@ void RtspPlayer::createUdpSockIfNecessary(int track_idx){
}
}
}
}
//发送SETUP命令
//发送SETUP命令
void
RtspPlayer
::
sendSetup
(
unsigned
int
trackIndex
)
{
void
RtspPlayer
::
sendSetup
(
unsigned
int
trackIndex
)
{
_onHandshake
=
std
::
bind
(
&
RtspPlayer
::
handleResSETUP
,
this
,
placeholders
::
_1
,
trackIndex
);
_onHandshake
=
std
::
bind
(
&
RtspPlayer
::
handleResSETUP
,
this
,
placeholders
::
_1
,
trackIndex
);
...
@@ -394,6 +396,7 @@ void RtspPlayer::sendPause(int type , uint32_t seekMS){
...
@@ -394,6 +396,7 @@ void RtspPlayer::sendPause(int type , uint32_t seekMS){
break
;
break
;
}
}
}
}
void
RtspPlayer
::
pause
(
bool
bPause
)
{
void
RtspPlayer
::
pause
(
bool
bPause
)
{
sendPause
(
bPause
?
type_pause
:
type_seek
,
getProgressMilliSecond
());
sendPause
(
bPause
?
type_pause
:
type_seek
,
getProgressMilliSecond
());
}
}
...
@@ -468,10 +471,8 @@ void RtspPlayer::onRtpPacket(const char *data, uint64_t len) {
...
@@ -468,10 +471,8 @@ void RtspPlayer::onRtpPacket(const char *data, uint64_t len) {
}
}
}
}
void
RtspPlayer
::
onRtcpPacket
(
int
iTrackidx
,
SdpTrack
::
Ptr
&
track
,
unsigned
char
*
pucData
,
unsigned
int
uiLen
){
//此处预留rtcp处理函数
void
RtspPlayer
::
onRtcpPacket
(
int
iTrackidx
,
SdpTrack
::
Ptr
&
track
,
unsigned
char
*
pucData
,
unsigned
int
uiLen
){}
}
#if 0
#if 0
//改代码提取自FFmpeg,参考之
//改代码提取自FFmpeg,参考之
...
@@ -597,7 +598,6 @@ void RtspPlayer::sendReceiverReport(bool overTcp,int iTrackIndex){
...
@@ -597,7 +598,6 @@ void RtspPlayer::sendReceiverReport(bool overTcp,int iTrackIndex){
}
}
}
}
void
RtspPlayer
::
onRtpSorted
(
const
RtpPacket
::
Ptr
&
rtppt
,
int
trackidx
){
void
RtspPlayer
::
onRtpSorted
(
const
RtpPacket
::
Ptr
&
rtppt
,
int
trackidx
){
//统计丢包率
//统计丢包率
if
(
_aui16FirstSeq
[
trackidx
]
==
0
||
rtppt
->
sequence
<
_aui16FirstSeq
[
trackidx
])
{
if
(
_aui16FirstSeq
[
trackidx
]
==
0
||
rtppt
->
sequence
<
_aui16FirstSeq
[
trackidx
])
{
...
@@ -613,6 +613,7 @@ void RtspPlayer::onRtpSorted(const RtpPacket::Ptr &rtppt, int trackidx){
...
@@ -613,6 +613,7 @@ void RtspPlayer::onRtpSorted(const RtpPacket::Ptr &rtppt, int trackidx){
rtppt
->
timeStamp
=
dts_out
;
rtppt
->
timeStamp
=
dts_out
;
onRecvRTP_l
(
rtppt
,
_aTrackInfo
[
trackidx
]);
onRecvRTP_l
(
rtppt
,
_aTrackInfo
[
trackidx
]);
}
}
float
RtspPlayer
::
getPacketLossRate
(
TrackType
type
)
const
{
float
RtspPlayer
::
getPacketLossRate
(
TrackType
type
)
const
{
int
iTrackIdx
=
getTrackIndexByTrackType
(
type
);
int
iTrackIdx
=
getTrackIndexByTrackType
(
type
);
if
(
iTrackIdx
==
-
1
){
if
(
iTrackIdx
==
-
1
){
...
@@ -637,6 +638,7 @@ float RtspPlayer::getPacketLossRate(TrackType type) const{
...
@@ -637,6 +638,7 @@ float RtspPlayer::getPacketLossRate(TrackType type) const{
uint32_t
RtspPlayer
::
getProgressMilliSecond
()
const
{
uint32_t
RtspPlayer
::
getProgressMilliSecond
()
const
{
return
MAX
(
_stamp
[
0
].
getRelativeStamp
(),
_stamp
[
1
].
getRelativeStamp
());
return
MAX
(
_stamp
[
0
].
getRelativeStamp
(),
_stamp
[
1
].
getRelativeStamp
());
}
}
void
RtspPlayer
::
seekToMilliSecond
(
uint32_t
ms
)
{
void
RtspPlayer
::
seekToMilliSecond
(
uint32_t
ms
)
{
sendPause
(
type_seek
,
ms
);
sendPause
(
type_seek
,
ms
);
}
}
...
@@ -654,6 +656,7 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std
...
@@ -654,6 +656,7 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std
}
}
sendRtspRequest
(
cmd
,
url
,
header_map
);
sendRtspRequest
(
cmd
,
url
,
header_map
);
}
}
void
RtspPlayer
::
sendRtspRequest
(
const
string
&
cmd
,
const
string
&
url
,
const
StrCaseMap
&
header_const
)
{
void
RtspPlayer
::
sendRtspRequest
(
const
string
&
cmd
,
const
string
&
url
,
const
StrCaseMap
&
header_const
)
{
auto
header
=
header_const
;
auto
header
=
header_const
;
header
.
emplace
(
"CSeq"
,
StrPrinter
<<
_uiCseq
++
);
header
.
emplace
(
"CSeq"
,
StrPrinter
<<
_uiCseq
++
);
...
@@ -725,9 +728,8 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &pkt, const SdpTrack::Ptr &tra
...
@@ -725,9 +728,8 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &pkt, const SdpTrack::Ptr &tra
ticker
.
resetTime
();
ticker
.
resetTime
();
}
}
}
}
}
}
void
RtspPlayer
::
onPlayResult_l
(
const
SockException
&
ex
,
bool
handshakeCompleted
)
{
void
RtspPlayer
::
onPlayResult_l
(
const
SockException
&
ex
,
bool
handshakeCompleted
)
{
WarnL
<<
ex
.
getErrCode
()
<<
" "
<<
ex
.
what
();
WarnL
<<
ex
.
getErrCode
()
<<
" "
<<
ex
.
what
();
...
@@ -795,5 +797,3 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType trackType) const {
...
@@ -795,5 +797,3 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType trackType) const {
}
}
}
/* namespace mediakit */
}
/* namespace mediakit */
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论