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-06-29 10:03:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ee072101054db3d8f580785cf076bcc0e4a0d650
ee072101
1 parent
e6f52428
fix demo script, start nginx. fix warning of utest on ubuntu14
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
37 行增加
和
16 行删除
trunk/scripts/build.sh
trunk/scripts/run.sh
trunk/scripts/stop.sh
trunk/src/libs/srs_librtmp.cpp
trunk/src/rtmp/srs_protocol_utility.cpp
trunk/src/rtmp/srs_protocol_utility.hpp
trunk/src/utest/srs_utest_handshake.cpp
trunk/scripts/build.sh
查看文件 @
ee07210
...
...
@@ -4,7 +4,7 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本";
# step 1: build srs
echo
"编译SRS"
./configure --x86-x64
&&
make
./configure --x86-x64
--with-nginx
&&
make
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"错误:编译SRS失败"
;
exit
$ret
;
fi
echo
"编译SRS成功"
...
...
trunk/scripts/run.sh
查看文件 @
ee07210
...
...
@@ -8,6 +8,9 @@ GREEN="\\e[32m"
YELLOW
=
"
\\
e[33m"
BLACK
=
"
\\
e[0m"
sudo ./objs/nginx/sbin/nginx
echo
"启动nginx"
./etc/init.d/srs-demo restart;
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"错误:启动SRS失败"
;
exit
$ret
;
fi
echo
"启动SRS服务器成功"
...
...
trunk/scripts/stop.sh
查看文件 @
ee07210
#!/bin/bash
sudo ./objs/nginx/sbin/nginx -s stop
echo
"停止nginx"
./etc/init.d/srs-demo stop;
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"错误:停止SRS失败"
;
exit
$ret
;
fi
echo
"停止SRS服务器成功"
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
ee07210
...
...
@@ -262,18 +262,7 @@ int srs_connect_app(srs_rtmp_t rtmp)
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
string
tcUrl
=
"rtmp://"
;
// TODO: FIXME: extrace shared method
if
(
context
->
vhost
==
RTMP_VHOST_DEFAULT
)
{
tcUrl
+=
context
->
ip
;
}
else
{
tcUrl
+=
context
->
vhost
;
}
tcUrl
+=
":"
;
tcUrl
+=
context
->
port
;
tcUrl
+=
"/"
;
tcUrl
+=
context
->
app
;
string
tcUrl
=
srs_generate_tc_url
(
context
->
ip
,
context
->
vhost
,
context
->
app
,
context
->
port
);
if
((
ret
=
context
->
rtmp
->
connect_app
(
context
->
app
,
tcUrl
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
trunk/src/rtmp/srs_protocol_utility.cpp
查看文件 @
ee07210
...
...
@@ -24,11 +24,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_protocol_utility.hpp>
#include <stdlib.h>
using
namespace
std
;
#include <srs_kernel_log.hpp>
#include <srs_kernel_utility.hpp>
void
srs_vhost_resolve
(
st
d
::
string
&
vhost
,
std
::
string
&
app
)
void
srs_vhost_resolve
(
st
ring
&
vhost
,
string
&
app
)
{
app
=
srs_string_replace
(
app
,
"..."
,
"?"
);
...
...
@@ -71,3 +72,24 @@ void srs_random_generate(char* bytes, int size)
bytes
[
i
]
=
cdata
[
rand
()
%
(
sizeof
(
cdata
)
-
1
)];
}
}
string
srs_generate_tc_url
(
string
ip
,
string
vhost
,
string
app
,
string
port
)
{
string
tcUrl
=
"rtmp://"
;
if
(
vhost
==
RTMP_VHOST_DEFAULT
)
{
tcUrl
+=
ip
;
}
else
{
tcUrl
+=
vhost
;
}
if
(
port
!=
RTMP_DEFAULT_PORT
)
{
tcUrl
+=
":"
;
tcUrl
+=
port
;
}
tcUrl
+=
"/"
;
tcUrl
+=
app
;
return
tcUrl
;
}
...
...
trunk/src/rtmp/srs_protocol_utility.hpp
查看文件 @
ee07210
...
...
@@ -31,9 +31,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
// default vhost
for
rtmp
// default vhost
of
rtmp
#define RTMP_VHOST_DEFAULT "__defaultVhost__"
// default port of rtmp
#define RTMP_DEFAULT_PORT "1935"
// the default chunk size for system.
...
...
@@ -45,6 +45,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// app...vhost...request_vhost
extern
void
srs_vhost_resolve
(
std
::
string
&
vhost
,
std
::
string
&
app
);
// generate ramdom data for handshake.
extern
void
srs_random_generate
(
char
*
bytes
,
int
size
);
// generate the tcUrl.
extern
std
::
string
srs_generate_tc_url
(
std
::
string
ip
,
std
::
string
vhost
,
std
::
string
app
,
std
::
string
port
);
#endif
...
...
trunk/src/utest/srs_utest_handshake.cpp
查看文件 @
ee07210
此 diff 太大无法显示。
请
注册
或
登录
后发表评论