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
2014-04-03 15:53:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b71eb0d49a35da838c473b90f3514dcd3430afdc
b71eb0d4
1 parent
f2216691
support more splash in http url. remove the strip of SrsRequest, use srs_string_…
…remove instead, change to 0.9.44
显示空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
77 行增加
和
42 行删除
trunk/src/app/srs_app_encoder.cpp
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/core/srs_core.cpp
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_rtmp.cpp
trunk/src/rtmp/srs_protocol_rtmp.hpp
trunk/src/rtmp/srs_protocol_utility.cpp
trunk/src/app/srs_app_encoder.cpp
查看文件 @
b71eb0d
...
...
@@ -111,11 +111,11 @@ int SrsFFMPEG::initialize(SrsRequest* req, SrsConfDirective* engine)
// output stream, to other/self server
// ie. rtmp://127.0.0.1:1935/live/livestream_sd
output
=
srs_replace
(
output
,
"[vhost]"
,
req
->
vhost
);
output
=
srs_replace
(
output
,
"[port]"
,
req
->
port
);
output
=
srs_replace
(
output
,
"[app]"
,
req
->
app
);
output
=
srs_replace
(
output
,
"[stream]"
,
req
->
stream
);
output
=
srs_replace
(
output
,
"[engine]"
,
engine
->
arg0
());
output
=
srs_string_replace
(
output
,
"[vhost]"
,
req
->
vhost
);
output
=
srs_string_replace
(
output
,
"[port]"
,
req
->
port
);
output
=
srs_string_replace
(
output
,
"[app]"
,
req
->
app
);
output
=
srs_string_replace
(
output
,
"[stream]"
,
req
->
stream
);
output
=
srs_string_replace
(
output
,
"[engine]"
,
engine
->
arg0
());
// write ffmpeg info to log file.
log_file
=
_srs_config
->
get_ffmpeg_log_dir
();
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
b71eb0d
...
...
@@ -338,7 +338,20 @@ void SrsHttpMessage::reset()
int
SrsHttpMessage
::
parse_uri
()
{
return
_uri
->
initialize
(
_url
);
// filter url according to HTTP specification.
// remove the duplicated slash.
std
::
string
filtered_url
=
srs_string_replace
(
_url
,
"//"
,
"/"
);
// remove the last / to match resource.
filtered_url
=
srs_string_trim_end
(
filtered_url
,
"/"
);
// if empty, use root.
if
(
filtered_url
.
empty
())
{
filtered_url
=
"/"
;
}
return
_uri
->
initialize
(
filtered_url
);
}
bool
SrsHttpMessage
::
is_complete
()
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
b71eb0d
...
...
@@ -239,7 +239,6 @@ int SrsRtmpConn::stream_service_cycle()
srs_error
(
"identify client failed. ret=%d"
,
ret
);
return
ret
;
}
req
->
strip
();
srs_trace
(
"identify client success. type=%s, stream_name=%s"
,
srs_client_type_string
(
type
).
c_str
(),
req
->
stream
.
c_str
());
...
...
trunk/src/core/srs_core.cpp
查看文件 @
b71eb0d
...
...
@@ -27,7 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <netdb.h>
#include <arpa/inet.h>
std
::
string
srs_replace
(
std
::
string
str
,
std
::
string
old_str
,
std
::
string
new_str
)
using
namespace
std
;
string
srs_string_replace
(
string
str
,
string
old_str
,
string
new_str
)
{
std
::
string
ret
=
str
;
...
...
@@ -38,13 +40,52 @@ std::string srs_replace(std::string str, std::string old_str, std::string new_st
size_t
pos
=
0
;
while
((
pos
=
ret
.
find
(
old_str
,
pos
))
!=
std
::
string
::
npos
)
{
ret
=
ret
.
replace
(
pos
,
old_str
.
length
(),
new_str
);
pos
+=
new_str
.
length
();
}
return
ret
;
}
std
::
string
srs_dns_resolve
(
std
::
string
host
)
string
srs_string_trim_end
(
string
str
,
string
trim_chars
)
{
std
::
string
ret
=
str
;
for
(
int
i
=
0
;
i
<
(
int
)
trim_chars
.
length
();
i
++
)
{
char
ch
=
trim_chars
.
at
(
i
);
while
(
!
ret
.
empty
()
&&
ret
.
at
(
ret
.
length
()
-
1
)
==
ch
)
{
ret
.
erase
(
ret
.
end
()
-
1
);
// ok, matched, should reset the search
i
=
0
;
}
}
return
ret
;
}
string
srs_string_remove
(
string
str
,
string
remove_chars
)
{
std
::
string
ret
=
str
;
for
(
int
i
=
0
;
i
<
(
int
)
remove_chars
.
length
();
i
++
)
{
char
ch
=
remove_chars
.
at
(
i
);
for
(
std
::
string
::
iterator
it
=
ret
.
begin
();
it
!=
ret
.
end
();)
{
if
(
ch
==
*
it
)
{
it
=
ret
.
erase
(
it
);
// ok, matched, should reset the search
i
=
0
;
}
else
{
++
it
;
}
}
}
return
ret
;
}
string
srs_dns_resolve
(
string
host
)
{
if
(
inet_addr
(
host
.
c_str
())
!=
INADDR_NONE
)
{
return
host
;
...
...
trunk/src/core/srs_core.hpp
查看文件 @
b71eb0d
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "4
3
"
#define VERSION_REVISION "4
4
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
...
...
@@ -91,8 +91,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SIGNAL_RELOAD SIGHUP
#include <string>
// replace utility
extern
std
::
string
srs_replace
(
std
::
string
str
,
std
::
string
old_str
,
std
::
string
new_str
);
// replace old_str to new_str of str
extern
std
::
string
srs_string_replace
(
std
::
string
str
,
std
::
string
old_str
,
std
::
string
new_str
);
// trim char in trim_chars of str
extern
std
::
string
srs_string_trim_end
(
std
::
string
str
,
std
::
string
trim_chars
);
// remove char in remove_chars of str
extern
std
::
string
srs_string_remove
(
std
::
string
str
,
std
::
string
remove_chars
);
// dns resolve utility, return the resolved ip address.
extern
std
::
string
srs_dns_resolve
(
std
::
string
host
);
// whether system is little endian
...
...
trunk/src/rtmp/srs_protocol_rtmp.cpp
查看文件 @
b71eb0d
...
...
@@ -127,7 +127,11 @@ int SrsRequest::discovery_app()
app
=
url
;
vhost
=
host
;
srs_vhost_resolve
(
vhost
,
app
);
strip
();
// remove the unsupported chars in names.
vhost
=
srs_string_remove
(
vhost
,
"/
\n\r\t
"
);
app
=
srs_string_remove
(
app
,
"
\n\r\t
"
);
stream
=
srs_string_remove
(
stream
,
"/
\n\r\t
"
);
return
ret
;
}
...
...
@@ -145,30 +149,6 @@ string SrsRequest::get_stream_url()
return
url
;
}
void
SrsRequest
::
strip
()
{
trim
(
vhost
,
"/
\n\r\t
"
);
trim
(
app
,
"/
\n\r\t
"
);
trim
(
stream
,
"/
\n\r\t
"
);
}
string
&
SrsRequest
::
trim
(
string
&
str
,
string
chs
)
{
for
(
int
i
=
0
;
i
<
(
int
)
chs
.
length
();
i
++
)
{
char
ch
=
chs
.
at
(
i
);
for
(
std
::
string
::
iterator
it
=
str
.
begin
();
it
!=
str
.
end
();)
{
if
(
ch
==
*
it
)
{
it
=
str
.
erase
(
it
);
}
else
{
++
it
;
}
}
}
return
str
;
}
SrsResponse
::
SrsResponse
()
{
stream_id
=
SRS_DEFAULT_SID
;
...
...
trunk/src/rtmp/srs_protocol_rtmp.hpp
查看文件 @
b71eb0d
...
...
@@ -82,9 +82,6 @@ public:
*/
virtual
int
discovery_app
();
virtual
std
::
string
get_stream_url
();
virtual
void
strip
();
private
:
std
::
string
&
trim
(
std
::
string
&
str
,
std
::
string
chs
);
};
/**
...
...
trunk/src/rtmp/srs_protocol_utility.cpp
查看文件 @
b71eb0d
...
...
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void
srs_vhost_resolve
(
std
::
string
&
vhost
,
std
::
string
&
app
)
{
app
=
srs_replace
(
app
,
"..."
,
"?"
);
app
=
srs_
string_
replace
(
app
,
"..."
,
"?"
);
size_t
pos
=
0
;
if
((
pos
=
app
.
find
(
"?"
))
==
std
::
string
::
npos
)
{
...
...
请
注册
或
登录
后发表评论