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-07-26 14:43:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7241fa874449408d30bac36e1d09912dda679e0c
7241fa87
1 parent
b17c736f
fix #126, srs_publiser add warnings. refine config utest.
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
84 行增加
和
8 行删除
trunk/research/librtmp/srs_publish.c
trunk/src/app/srs_app_log.cpp
trunk/src/app/srs_app_log.hpp
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_log.hpp
trunk/src/utest/srs_utest.cpp
trunk/src/utest/srs_utest.hpp
trunk/src/utest/srs_utest_config.cpp
trunk/research/librtmp/srs_publish.c
查看文件 @
7241fa8
...
...
@@ -42,6 +42,13 @@ int main(int argc, char** argv)
printf
(
"publish rtmp stream to server like FMLE/FFMPEG/Encoder
\n
"
);
printf
(
"srs(simple-rtmp-server) client librtmp library.
\n
"
);
printf
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
// warn it .
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/126
printf
(
"
\033
[33m%s
\033
[0m"
,
"[warning] it's only a sample to use librtmp. "
"please never use it to publish and test forward/transcode/edge/HLS whatever. "
"you should refer to this tool to use the srs-librtmp to publish the real media stream."
);
printf
(
"
\n
"
);
rtmp
=
srs_rtmp_create
(
"rtmp://127.0.0.1:1935/live/livestream"
);
...
...
trunk/src/app/srs_app_log.cpp
查看文件 @
7241fa8
...
...
@@ -80,17 +80,21 @@ SrsFastLog::~SrsFastLog()
fd
=
-
1
;
}
_srs_config
->
unsubscribe
(
this
);
if
(
_srs_config
)
{
_srs_config
->
unsubscribe
(
this
);
}
}
int
SrsFastLog
::
initialize
()
{
int
ret
=
ERROR_SUCCESS
;
_srs_config
->
subscribe
(
this
);
log_to_file_tank
=
_srs_config
->
get_log_tank_file
();
_level
=
srs_get_log_level
(
_srs_config
->
get_log_level
());
if
(
_srs_config
)
{
_srs_config
->
subscribe
(
this
);
log_to_file_tank
=
_srs_config
->
get_log_tank_file
();
_level
=
srs_get_log_level
(
_srs_config
->
get_log_level
());
}
return
ret
;
}
...
...
trunk/src/app/srs_app_log.hpp
查看文件 @
7241fa8
...
...
@@ -60,7 +60,8 @@ public:
*/
class
SrsFastLog
:
public
ISrsLog
,
public
ISrsReloadHandler
{
private
:
// for utest to override
protected:
// defined in SrsLogLevel.
int
_level
;
char
*
log_data
;
...
...
trunk/src/core/srs_core.hpp
查看文件 @
7241fa8
...
...
@@ -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 "17
1
"
#define VERSION_REVISION "17
2
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/kernel/srs_kernel_log.hpp
查看文件 @
7241fa8
...
...
@@ -52,6 +52,8 @@ public:
static
const
int
Trace
=
0x03
;
static
const
int
Warn
=
0x04
;
static
const
int
Error
=
0x05
;
// specified the disabled level, no log, for utest.
static
const
int
Disabled
=
0x06
;
};
/**
...
...
trunk/src/utest/srs_utest.cpp
查看文件 @
7241fa8
...
...
@@ -30,12 +30,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_log.hpp>
// kernel module.
ISrsLog
*
_srs_log
=
new
ISrsLog
(
);
ISrsLog
*
_srs_log
=
new
MockEmptyLog
(
SrsLogLevel
::
Disabled
);
ISrsThreadContext
*
_srs_context
=
new
ISrsThreadContext
();
// app module.
SrsConfig
*
_srs_config
=
NULL
;
SrsServer
*
_srs_server
=
NULL
;
MockEmptyLog
::
MockEmptyLog
(
int
level
)
{
_level
=
level
;
}
MockEmptyLog
::~
MockEmptyLog
()
{
}
int
MockEmptyLog
::
on_reload_log_tank
()
{
return
ERROR_SUCCESS
;
}
int
MockEmptyLog
::
on_reload_log_level
()
{
return
ERROR_SUCCESS
;
}
int
MockEmptyLog
::
on_reload_log_file
()
{
return
ERROR_SUCCESS
;
}
void
__srs_bytes_print
(
char
*
pa
,
int
size
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
...
...
trunk/src/utest/srs_utest.hpp
查看文件 @
7241fa8
...
...
@@ -31,6 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gtest/gtest.h"
#include <srs_app_log.hpp>
// we add an empty macro for upp to show the smart tips.
#define VOID
...
...
@@ -52,4 +54,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// print the bytes.
void
__srs_bytes_print
(
char
*
pa
,
int
size
);
class
MockEmptyLog
:
public
SrsFastLog
{
private
:
int
_level
;
public
:
MockEmptyLog
(
int
level
);
virtual
~
MockEmptyLog
();
public
:
virtual
int
on_reload_log_tank
();
virtual
int
on_reload_log_level
();
virtual
int
on_reload_log_file
();
};
#endif
...
...
trunk/src/utest/srs_utest_config.cpp
查看文件 @
7241fa8
...
...
@@ -4341,3 +4341,26 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed)
EXPECT_STREQ
(
"/"
,
conf
.
get_vhost_http_mount
(
vhost
).
c_str
());
EXPECT_STREQ
(
"./objs/nginx/html"
,
conf
.
get_vhost_http_dir
(
vhost
).
c_str
());
}
VOID
TEST
(
ConfigMainTest
,
CheckConf_listen
)
{
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listens 1935;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listen 0;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listen -1;"
));
}
if
(
true
)
{
MockSrsConfig
conf
;
EXPECT_TRUE
(
ERROR_SUCCESS
!=
conf
.
parse
(
"listen -1935;"
));
}
}
...
...
请
注册
或
登录
后发表评论