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-03-02 09:48:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b7a62ba131ddab9251e192f7e95f4971b8331a90
b7a62ba1
1 parent
feaf0c5e
use goto to free resource
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
18 行增加
和
9 行删除
trunk/research/librtmp/srs_play.c
trunk/research/librtmp/srs_publish.c
trunk/src/libs/srs_librtmp.cpp
trunk/research/librtmp/srs_play.c
查看文件 @
b7a62ba
...
...
@@ -39,22 +39,23 @@ int main(int argc, char** argv)
if
(
srs_simple_handshake
(
rtmp
)
!=
0
)
{
printf
(
"simple handshake failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"simple handshake success
\n
"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
printf
(
"connect vhost/app failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"connect vhost/app success
\n
"
);
if
(
srs_play_stream
(
rtmp
)
!=
0
)
{
printf
(
"play stream failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"play stream success
\n
"
);
rtmp_destroy:
srs_rtmp_destroy
(
rtmp
);
return
0
;
...
...
trunk/research/librtmp/srs_publish.c
查看文件 @
b7a62ba
...
...
@@ -39,22 +39,23 @@ int main(int argc, char** argv)
if
(
srs_simple_handshake
(
rtmp
)
!=
0
)
{
printf
(
"simple handshake failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"simple handshake success
\n
"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
printf
(
"connect vhost/app failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"connect vhost/app success
\n
"
);
if
(
srs_publish_stream
(
rtmp
)
!=
0
)
{
printf
(
"publish stream failed.
\n
"
);
return
-
1
;
goto
rtmp_destroy
;
}
printf
(
"publish stream success
\n
"
);
rtmp_destroy:
srs_rtmp_destroy
(
rtmp
);
return
0
;
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
b7a62ba
...
...
@@ -39,17 +39,17 @@ struct Context
{
std
::
string
url
;
SrsRtmpClient
*
rtmp
;
SimpleSocketStream
*
s
tream
;
SimpleSocketStream
*
s
kt
;
int
stream_id
;
Context
()
{
rtmp
=
NULL
;
s
tream
=
NULL
;
s
kt
=
NULL
;
stream_id
=
0
;
}
virtual
~
Context
()
{
srs_freep
(
rtmp
);
srs_freep
(
s
tream
);
srs_freep
(
s
kt
);
}
};
...
...
@@ -66,11 +66,18 @@ srs_rtmp_t srs_rtmp_create(const char* url){
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
){
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
srs_freep
(
context
);
}
int
srs_simple_handshake
(
srs_rtmp_t
rtmp
)
{
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
srs_freep
(
context
->
skt
);
context
->
skt
=
new
SimpleSocketStream
();
return
ERROR_SUCCESS
;
}
...
...
请
注册
或
登录
后发表评论