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
df14924a
Commit
df14924a
authored
Nov 15, 2022
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化rtmp服务器兼容性: #2078
parent
034e29b2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
12 行删除
+16
-12
src/Rtmp/RtmpProtocol.h
+2
-2
src/Rtmp/RtmpSession.cpp
+14
-10
没有找到文件。
src/Rtmp/RtmpProtocol.h
查看文件 @
df14924a
...
@@ -84,12 +84,12 @@ private:
...
@@ -84,12 +84,12 @@ private:
protected
:
protected
:
int
_send_req_id
=
0
;
int
_send_req_id
=
0
;
int
_now_stream_index
=
0
;
uint32_t
_stream_index
=
STREAM_CONTROL
;
uint32_t
_stream_index
=
STREAM_CONTROL
;
private
:
private
:
int
_now_stream_index
=
0
;
int
_now_chunk_id
=
0
;
bool
_data_started
=
false
;
bool
_data_started
=
false
;
int
_now_chunk_id
=
0
;
////////////ChunkSize////////////
////////////ChunkSize////////////
size_t
_chunk_size_in
=
DEFAULT_CHUNK_LEN
;
size_t
_chunk_size_in
=
DEFAULT_CHUNK_LEN
;
size_t
_chunk_size_out
=
DEFAULT_CHUNK_LEN
;
size_t
_chunk_size_out
=
DEFAULT_CHUNK_LEN
;
...
...
src/Rtmp/RtmpSession.cpp
查看文件 @
df14924a
...
@@ -122,9 +122,9 @@ void RtmpSession::onCmd_createStream(AMFDecoder &dec) {
...
@@ -122,9 +122,9 @@ void RtmpSession::onCmd_createStream(AMFDecoder &dec) {
void
RtmpSession
::
onCmd_publish
(
AMFDecoder
&
dec
)
{
void
RtmpSession
::
onCmd_publish
(
AMFDecoder
&
dec
)
{
std
::
shared_ptr
<
Ticker
>
ticker
(
new
Ticker
);
std
::
shared_ptr
<
Ticker
>
ticker
(
new
Ticker
);
weak_ptr
<
RtmpSession
>
weak_self
=
dynamic_pointer_cast
<
RtmpSession
>
(
shared_from_this
());
weak_ptr
<
RtmpSession
>
weak_self
=
dynamic_pointer_cast
<
RtmpSession
>
(
shared_from_this
());
std
::
shared_ptr
<
onceToken
>
pToken
(
new
onceToken
(
nullptr
,[
ticker
,
weak_self
]()
{
std
::
shared_ptr
<
onceToken
>
token
(
new
onceToken
(
nullptr
,
[
ticker
,
weak_self
]()
{
auto
strong_self
=
weak_self
.
lock
();
auto
strong_self
=
weak_self
.
lock
();
if
(
strong_self
)
{
if
(
strong_self
)
{
DebugP
(
strong_self
.
get
())
<<
"publish 回复时间:"
<<
ticker
->
elapsedTime
()
<<
"ms"
;
DebugP
(
strong_self
.
get
())
<<
"publish 回复时间:"
<<
ticker
->
elapsedTime
()
<<
"ms"
;
}
}
}));
}));
...
@@ -132,7 +132,9 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
...
@@ -132,7 +132,9 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
_media_info
.
parse
(
_tc_url
+
"/"
+
getStreamId
(
dec
.
load
<
std
::
string
>
()));
_media_info
.
parse
(
_tc_url
+
"/"
+
getStreamId
(
dec
.
load
<
std
::
string
>
()));
_media_info
.
_schema
=
RTMP_SCHEMA
;
_media_info
.
_schema
=
RTMP_SCHEMA
;
auto
on_res
=
[
this
,
pToken
](
const
string
&
err
,
const
ProtocolOption
&
option
)
{
auto
now_stream_index
=
_now_stream_index
;
auto
on_res
=
[
this
,
token
,
now_stream_index
](
const
string
&
err
,
const
ProtocolOption
&
option
)
{
_now_stream_index
=
now_stream_index
;
if
(
!
err
.
empty
())
{
if
(
!
err
.
empty
())
{
sendStatus
({
"level"
,
"error"
,
sendStatus
({
"level"
,
"error"
,
"code"
,
"NetStream.Publish.BadAuth"
,
"code"
,
"NetStream.Publish.BadAuth"
,
...
@@ -196,12 +198,12 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
...
@@ -196,12 +198,12 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
return
;
return
;
}
}
Broadcast
::
PublishAuthInvoker
invoker
=
[
weak_self
,
on_res
,
pT
oken
](
const
string
&
err
,
const
ProtocolOption
&
option
)
{
Broadcast
::
PublishAuthInvoker
invoker
=
[
weak_self
,
on_res
,
t
oken
](
const
string
&
err
,
const
ProtocolOption
&
option
)
{
auto
strong_self
=
weak_self
.
lock
();
auto
strong_self
=
weak_self
.
lock
();
if
(
!
strong_self
)
{
if
(
!
strong_self
)
{
return
;
return
;
}
}
strong_self
->
async
([
weak_self
,
on_res
,
err
,
pT
oken
,
option
]()
{
strong_self
->
async
([
weak_self
,
on_res
,
err
,
t
oken
,
option
]()
{
auto
strong_self
=
weak_self
.
lock
();
auto
strong_self
=
weak_self
.
lock
();
if
(
!
strong_self
)
{
if
(
!
strong_self
)
{
return
;
return
;
...
@@ -361,24 +363,26 @@ void RtmpSession::doPlay(AMFDecoder &dec){
...
@@ -361,24 +363,26 @@ void RtmpSession::doPlay(AMFDecoder &dec){
DebugP
(
strong_self
.
get
())
<<
"play 回复时间:"
<<
ticker
->
elapsedTime
()
<<
"ms"
;
DebugP
(
strong_self
.
get
())
<<
"play 回复时间:"
<<
ticker
->
elapsedTime
()
<<
"ms"
;
}
}
}));
}));
Broadcast
::
AuthInvoker
invoker
=
[
weak_self
,
token
](
const
string
&
err
){
auto
now_stream_index
=
_now_stream_index
;
Broadcast
::
AuthInvoker
invoker
=
[
weak_self
,
token
,
now_stream_index
](
const
string
&
err
)
{
auto
strong_self
=
weak_self
.
lock
();
auto
strong_self
=
weak_self
.
lock
();
if
(
!
strong_self
)
{
if
(
!
strong_self
)
{
return
;
return
;
}
}
strong_self
->
async
([
weak_self
,
err
,
token
]()
{
strong_self
->
async
([
weak_self
,
err
,
token
,
now_stream_index
]()
{
auto
strong_self
=
weak_self
.
lock
();
auto
strong_self
=
weak_self
.
lock
();
if
(
!
strong_self
)
{
if
(
!
strong_self
)
{
return
;
return
;
}
}
strong_self
->
_now_stream_index
=
now_stream_index
;
strong_self
->
doPlayResponse
(
err
,
[
token
](
bool
)
{});
strong_self
->
doPlayResponse
(
err
,
[
token
](
bool
)
{});
});
});
};
};
auto
flag
=
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastMediaPlayed
,
_media_info
,
invoker
,
static_cast
<
SockInfo
&>
(
*
this
));
auto
flag
=
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastMediaPlayed
,
_media_info
,
invoker
,
static_cast
<
SockInfo
&>
(
*
this
));
if
(
!
flag
)
{
if
(
!
flag
)
{
//该事件无人监听,默认不鉴权
//
该事件无人监听,默认不鉴权
doPlayResponse
(
""
,
[
token
](
bool
)
{});
doPlayResponse
(
""
,
[
token
](
bool
)
{});
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论