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
9a9040ec
Unverified
Commit
9a9040ec
authored
Apr 28, 2023
by
alexliyu7352
Committed by
GitHub
Apr 28, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2428 from alexliyu7352/patch-56
避免服务器端返回content-length=0时,TsPlayer不能正确释放的问题
parents
2708c85d
b3d4188f
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
4 行删除
+9
-4
src/Http/HttpClient.cpp
+3
-3
src/Http/TsPlayer.cpp
+6
-1
没有找到文件。
src/Http/HttpClient.cpp
查看文件 @
9a9040ec
...
@@ -226,7 +226,7 @@ ssize_t HttpClient::onRecvHeader(const char *data, size_t len) {
...
@@ -226,7 +226,7 @@ ssize_t HttpClient::onRecvHeader(const char *data, size_t len) {
if
(
_total_body_size
==
0
)
{
if
(
_total_body_size
==
0
)
{
//后续没content,本次http请求结束
//后续没content,本次http请求结束
onResponseCompleted_l
(
SockException
(
Err_success
,
"
success
"
));
onResponseCompleted_l
(
SockException
(
Err_success
,
"
The request is successful but has no body
"
));
return
0
;
return
0
;
}
}
...
@@ -260,7 +260,7 @@ void HttpClient::onRecvContent(const char *data, size_t len) {
...
@@ -260,7 +260,7 @@ void HttpClient::onRecvContent(const char *data, size_t len) {
if
(
_recved_body_size
==
(
size_t
)
_total_body_size
)
{
if
(
_recved_body_size
==
(
size_t
)
_total_body_size
)
{
//content接收完毕
//content接收完毕
onResponseBody
(
data
,
len
);
onResponseBody
(
data
,
len
);
onResponseCompleted_l
(
SockException
(
Err_success
,
"
success
"
));
onResponseCompleted_l
(
SockException
(
Err_success
,
"
completed
"
));
return
;
return
;
}
}
...
@@ -329,7 +329,7 @@ void HttpClient::onResponseCompleted_l(const SockException &ex) {
...
@@ -329,7 +329,7 @@ void HttpClient::onResponseCompleted_l(const SockException &ex) {
if
(
_total_body_size
>
0
&&
_recved_body_size
>=
(
size_t
)
_total_body_size
)
{
if
(
_total_body_size
>
0
&&
_recved_body_size
>=
(
size_t
)
_total_body_size
)
{
//回复header中有content-length信息,那么收到的body大于等于声明值则认为成功
//回复header中有content-length信息,那么收到的body大于等于声明值则认为成功
onResponseCompleted
(
SockException
(
Err_success
,
"
success
"
));
onResponseCompleted
(
SockException
(
Err_success
,
"
read body completed
"
));
return
;
return
;
}
}
...
...
src/Http/TsPlayer.cpp
查看文件 @
9a9040ec
...
@@ -34,7 +34,12 @@ void TsPlayer::teardown() {
...
@@ -34,7 +34,12 @@ void TsPlayer::teardown() {
void
TsPlayer
::
onResponseCompleted
(
const
SockException
&
ex
)
{
void
TsPlayer
::
onResponseCompleted
(
const
SockException
&
ex
)
{
if
(
!
_play_result
)
{
if
(
!
_play_result
)
{
_play_result
=
true
;
_play_result
=
true
;
if
(
!
ex
&&
responseBodyTotalSize
()
==
0
&&
responseBodySize
()
==
0
)
{
//if the server does not return any data, it is considered a failure
onShutdown
(
ex
);
}
else
{
onPlayResult
(
ex
);
onPlayResult
(
ex
);
}
}
else
{
}
else
{
onShutdown
(
ex
);
onShutdown
(
ex
);
}
}
...
@@ -44,7 +49,7 @@ void TsPlayer::onResponseCompleted(const SockException &ex) {
...
@@ -44,7 +49,7 @@ void TsPlayer::onResponseCompleted(const SockException &ex) {
void
TsPlayer
::
onResponseBody
(
const
char
*
buf
,
size_t
size
)
{
void
TsPlayer
::
onResponseBody
(
const
char
*
buf
,
size_t
size
)
{
if
(
!
_play_result
)
{
if
(
!
_play_result
)
{
_play_result
=
true
;
_play_result
=
true
;
onPlayResult
(
SockException
(
Err_success
,
"
play http-ts success
"
));
onPlayResult
(
SockException
(
Err_success
,
"
read http-ts stream successfully
"
));
}
}
if
(
!
_benchmark_mode
)
{
if
(
!
_benchmark_mode
)
{
HttpTSPlayer
::
onResponseBody
(
buf
,
size
);
HttpTSPlayer
::
onResponseBody
(
buf
,
size
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论