Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-05-30 13:48:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4a80a5a71ee508937edf78469f49a8b76a3ac2c0
4a80a5a7
1 parent
860d68e6
for #209, support cleanup when srs stop.
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
52 行增加
和
6 行删除
README.md
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
README.md
查看文件 @
4a80a5a
...
...
@@ -250,7 +250,7 @@ Compare SRS with other media server.
| RTMP Edge | Stable | X | X | Stable | X |
| RTMP Backup | Stable | X | X | X | X |
| VHOST | Stable | X | X | Stable | Stable |
| Reload | Stable |
Stable
| X | X | X |
| Reload | Stable |
X
| X | X | X |
| Forward | Stable | X | X | X | X |
| ATC | Stable | X | X | X | X |
...
...
@@ -312,6 +312,7 @@ Remark:
1.
HLS aonly: The HLS audio only streaming delivery.
1.
BW check: The bandwidth check.
1.
Security: To allow or deny stream publish or play.
1.
Reload: Nginx supports reload, but not nginx-rtmp.
## Releases
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
4a80a5a
...
...
@@ -292,6 +292,7 @@ SrsHlsMuxer::SrsHlsMuxer()
SrsHlsMuxer
::~
SrsHlsMuxer
()
{
std
::
vector
<
SrsHlsSegment
*>::
iterator
it
;
for
(
it
=
segments
.
begin
();
it
!=
segments
.
end
();
++
it
)
{
SrsHlsSegment
*
segment
=
*
it
;
...
...
@@ -305,6 +306,40 @@ SrsHlsMuxer::~SrsHlsMuxer()
srs_freep
(
context
);
}
void
SrsHlsMuxer
::
dispose
()
{
if
(
!
should_write_file
)
{
return
;
}
std
::
vector
<
SrsHlsSegment
*>::
iterator
it
;
for
(
it
=
segments
.
begin
();
it
!=
segments
.
end
();
++
it
)
{
SrsHlsSegment
*
segment
=
*
it
;
if
(
unlink
(
segment
->
full_path
.
c_str
())
<
0
)
{
srs_warn
(
"dispose unlink path failed, file=%s."
,
segment
->
full_path
.
c_str
());
}
}
if
(
current
)
{
std
::
string
path
=
current
->
full_path
+
".tmp"
;
if
(
unlink
(
path
.
c_str
())
<
0
)
{
srs_warn
(
"dispose unlink path failed, file=%s"
,
path
.
c_str
());
}
}
if
(
unlink
(
m3u8
.
c_str
())
<
0
)
{
srs_warn
(
"dispose unlink path failed. file=%s"
,
m3u8
.
c_str
());
}
srs_trace
(
"gracefully dispose hls %s"
,
req
?
req
->
get_stream_url
().
c_str
()
:
""
);
}
int
SrsHlsMuxer
::
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
// TODO: FIXME: implements it.
return
ret
;
}
int
SrsHlsMuxer
::
sequence_no
()
{
return
_sequence_no
;
...
...
@@ -720,6 +755,9 @@ int SrsHlsMuxer::segment_close(string log_desc)
std
::
string
tmp_file
=
current
->
full_path
+
".tmp"
;
if
(
should_write_file
)
{
unlink
(
tmp_file
.
c_str
());
if
(
unlink
(
tmp_file
.
c_str
())
<
0
)
{
srs_warn
(
"drop unlink path failed, file=%s."
,
tmp_file
.
c_str
());
}
}
srs_freep
(
current
);
...
...
@@ -754,7 +792,9 @@ int SrsHlsMuxer::segment_close(string log_desc)
SrsHlsSegment
*
segment
=
segment_to_remove
[
i
];
if
(
hls_cleanup
)
{
unlink
(
segment
->
full_path
.
c_str
());
if
(
unlink
(
segment
->
full_path
.
c_str
())
<
0
)
{
srs_warn
(
"cleanup unlink path failed, file=%s."
,
segment
->
full_path
.
c_str
());
}
}
srs_freep
(
segment
);
...
...
@@ -1111,15 +1151,17 @@ SrsHls::~SrsHls()
void
SrsHls
::
dispose
()
{
if
(
hls_enabled
)
{
on_unpublish
();
}
muxer
->
dispose
();
}
int
SrsHls
::
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
srs_info
(
"hls cycle for source %d"
,
source
->
source_id
());
return
ret
;
return
muxer
->
cycle
();
}
int
SrsHls
::
initialize
(
SrsSource
*
s
,
ISrsHlsHandler
*
h
)
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
4a80a5a
...
...
@@ -260,6 +260,9 @@ public:
SrsHlsMuxer
();
virtual
~
SrsHlsMuxer
();
public
:
virtual
void
dispose
();
virtual
int
cycle
();
public
:
virtual
int
sequence_no
();
virtual
std
::
string
ts_url
();
virtual
double
duration
();
...
...
请
注册
或
登录
后发表评论