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-12-11 11:35:56 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ffef3905afc4577884dcec971e9b225052eabe9b
ffef3905
2 parents
1e4c8f8b
5660e249
merge from srs2.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
26 行增加
和
3 行删除
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_http_hooks.cpp
trunk/src/app/srs_app_utility.cpp
trunk/src/app/srs_app_utility.hpp
trunk/src/main/srs_main_ingest_hls.cpp
trunk/src/app/srs_app_hls.cpp
查看文件 @
ffef390
...
...
@@ -557,6 +557,12 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
current
->
uri
+=
hls_entry_prefix
;
if
(
!
hls_entry_prefix
.
empty
()
&&
!
srs_string_ends_with
(
hls_entry_prefix
,
"/"
))
{
current
->
uri
+=
"/"
;
// add the http dir to uri.
string
http_dir
=
srs_path_dirname
(
m3u8_url
);
if
(
!
http_dir
.
empty
())
{
current
->
uri
+=
http_dir
+
"/"
;
}
}
current
->
uri
+=
ts_url
;
...
...
trunk/src/app/srs_app_http_hooks.cpp
查看文件 @
ffef390
...
...
@@ -39,6 +39,7 @@ using namespace std;
#include <srs_kernel_utility.hpp>
#include <srs_app_http_conn.hpp>
#include <srs_protocol_amf0.hpp>
#include <srs_app_utility.hpp>
#define SRS_HTTP_RESPONSE_OK SRS_XSTR(ERROR_SUCCESS)
...
...
@@ -315,6 +316,12 @@ int SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string file, stri
int
client_id
=
cid
;
std
::
string
cwd
=
_srs_config
->
cwd
();
// the ts_url is under the same dir of m3u8_url.
string
prefix
=
srs_path_dirname
(
m3u8_url
);
if
(
!
prefix
.
empty
()
&&
!
srs_string_is_http
(
ts_url
))
{
ts_url
=
prefix
+
"/"
+
ts_url
;
}
SrsJsonObject
*
obj
=
SrsJsonAny
::
object
();
SrsAutoFree
(
SrsJsonObject
,
obj
);
...
...
@@ -358,7 +365,7 @@ int SrsHttpHooks::on_hls_notify(int cid, std::string url, SrsRequest* req, std::
int
client_id
=
cid
;
std
::
string
cwd
=
_srs_config
->
cwd
();
if
(
srs_string_
starts_with
(
ts_url
,
"http://"
)
||
srs_string_starts_with
(
ts_url
,
"https://"
))
{
if
(
srs_string_
is_http
(
ts_url
))
{
url
=
ts_url
;
}
...
...
trunk/src/app/srs_app_utility.cpp
查看文件 @
ffef390
...
...
@@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <arpa/inet.h>
#include <signal.h>
#include <sys/wait.h>
#include <math.h>
#ifdef SRS_OSX
#include <sys/sysctl.h>
...
...
@@ -47,6 +48,7 @@ using namespace std;
#include <srs_protocol_json.hpp>
#include <srs_kernel_buffer.hpp>
#include <srs_protocol_amf0.hpp>
#include <srs_kernel_utility.hpp>
// the longest time to wait for a process to quit.
#define SRS_PROCESS_QUIT_TIMEOUT_MS 1000
...
...
@@ -1340,6 +1342,11 @@ string srs_get_peer_ip(int fd)
return
ip
;
}
bool
srs_string_is_http
(
string
url
)
{
return
srs_string_starts_with
(
url
,
"http://"
,
"https://"
);
}
bool
srs_is_digit_number
(
const
string
&
str
)
{
if
(
str
.
empty
())
{
...
...
trunk/src/app/srs_app_utility.hpp
查看文件 @
ffef390
...
...
@@ -662,6 +662,9 @@ extern int srs_get_local_port(int fd);
// where peer ip is the client public ip which connected to server.
extern
std
::
string
srs_get_peer_ip
(
int
fd
);
// whether the url is starts with http:// or https://
extern
bool
srs_string_is_http
(
std
::
string
url
);
// whether string is digit number
// is_digit("1234567890") === true
// is_digit("0123456789") === false
...
...
trunk/src/main/srs_main_ingest_hls.cpp
查看文件 @
ffef390
...
...
@@ -460,7 +460,7 @@ int SrsIngestSrsInput::parseM3u8(SrsHttpUri* url, double& td, double& duration)
std
::
string
m3u8_url
=
body
.
substr
(
0
,
pos
);
body
=
body
.
substr
(
pos
+
1
);
if
(
!
srs_string_
starts_with
(
m3u8_url
,
"http://"
))
{
if
(
!
srs_string_
is_http
(
m3u8_url
))
{
m3u8_url
=
srs_path_dirname
(
url
->
get_url
())
+
"/"
+
m3u8_url
;
}
srs_trace
(
"parse sub m3u8, url=%s"
,
m3u8_url
.
c_str
());
...
...
@@ -594,7 +594,7 @@ int SrsIngestSrsInput::SrsTsPiece::fetch(string m3u8)
SrsHttpClient
client
;
std
::
string
ts_url
=
url
;
if
(
!
srs_string_
starts_with
(
ts_url
,
"http://"
))
{
if
(
!
srs_string_
is_http
(
ts_url
))
{
ts_url
=
srs_path_dirname
(
m3u8
)
+
"/"
+
url
;
}
...
...
请
注册
或
登录
后发表评论