mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
remove the complex handshake of librtmp. refine makefile of librtmp tools
This commit is contained in:
parent
69248cedaa
commit
93c9c55fb9
5 changed files with 39 additions and 91 deletions
76
trunk/research/librtmp/Makefile
Executable file → Normal file
76
trunk/research/librtmp/Makefile
Executable file → Normal file
|
@ -1,24 +1,26 @@
|
|||
GCC = gcc
|
||||
|
||||
ifeq ($(HANDSHAKE),)
|
||||
ST_ALL = help
|
||||
else
|
||||
ST_ALL = srs_flv_parser srs_publish srs_play srs_ingest_flv srs_ingest_rtmp
|
||||
endif
|
||||
|
||||
.PHONY: default clean help ssl nossl
|
||||
|
||||
default: help
|
||||
default: $(ST_ALL)
|
||||
|
||||
help:
|
||||
@echo "Usage: make <help>|<clean>|<srs_flv_parser>|<srs_publish_nossl>|<srs_play_nossl>|<srs_ingest_flv_nossl>|<srs_ingest_rtmp_nossl>|<srs_publish_ssl>|<srs_play_ssl>|<srs_ingest_flv_ssl>|<srs_ingest_rtmp_ssl>"
|
||||
@echo "Usage: make <help>|<clean>|<srs_flv_parser>|<srs_publish>|<srs_play>|<srs_ingest_flv>|<srs_ingest_rtmp>"
|
||||
@echo " help display this help"
|
||||
@echo " clean cleanup build"
|
||||
@echo " ssl srs_flv_parser, srs_publish_ssl, srs_play_ssl, srs_ingest_flv, srs_ingest_rtmp"
|
||||
@echo " nossl srs_flv_parser, srs_publish_nossl, srs_play_nossl, srs_ingest_flv, srs_ingest_rtmp"
|
||||
@echo " ssl all tools link ssl"
|
||||
@echo " nossl all tools never link ssl"
|
||||
@echo " srs_flv_parser parse flv file, print detail info."
|
||||
@echo " srs_publish_nossl publish program using srs-librtmp, without ssl(simple handshake)"
|
||||
@echo " srs_play_nossl play program using srs-librtmp, without ssl(simple handshake)"
|
||||
@echo " srs_publish_ssl publish program using srs-librtmp, with ssl(complex handshake)"
|
||||
@echo " srs_play_ssl play program using srs-librtmp, with ssl(complex handshake)"
|
||||
@echo " srs_ingest_flv_nossl ingest flv file and publish to RTMP server. (simple handshake)"
|
||||
@echo " srs_ingest_rtmp_nossl ingest RTMP and publish to RTMP server. (simple handshake)"
|
||||
@echo " srs_ingest_flv_ssl ingest flv file and publish to RTMP server. (complex handshake)"
|
||||
@echo " srs_ingest_rtmp_ssl ingest RTMP and publish to RTMP server. (complex handshake)"
|
||||
@echo " srs_publish publish program using srs-librtmp"
|
||||
@echo " srs_play play program using srs-librtmp"
|
||||
@echo " srs_ingest_flv ingest flv file and publish to RTMP server."
|
||||
@echo " srs_ingest_rtmp ingest RTMP and publish to RTMP server."
|
||||
@echo "Remark: about simple/complex handshake, see: http://blog.csdn.net/win_lin/article/details/13006803"
|
||||
@echo "Remark: srs Makefile will auto invoke this by --with/without-ssl, "
|
||||
@echo " that is, if user specified ssl(by --with-ssl), srs will make this by 'make ssl'"
|
||||
|
@ -27,7 +29,7 @@ help:
|
|||
@echo "Remark: before make this sample, user must make the srs, with/without ssl"
|
||||
|
||||
clean:
|
||||
@rm -f srs_flv_parser srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl srs_ingest_flv_nossl srs_ingest_rtmp_nossl
|
||||
@rm -f srs_flv_parser srs_publish srs_play srs_ingest_flv srs_ingest_rtmp
|
||||
|
||||
# srs library root
|
||||
SRS_OBJS = ../../objs
|
||||
|
@ -35,7 +37,7 @@ SRS_OBJS = ../../objs
|
|||
SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h
|
||||
SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a
|
||||
# openssl for complex handshake, built by srs.
|
||||
SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypto.a
|
||||
SRS_LIBSSL_L =
|
||||
# the research public headers
|
||||
SRS_RESEARCH_DEPS = Makefile srs_research_public.h
|
||||
|
||||
|
@ -51,37 +53,27 @@ endif
|
|||
ifeq ($(GCC), mipsel-openwrt-linux-gcc)
|
||||
EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++ -lgcc_eh
|
||||
endif
|
||||
# for ssl or nossl
|
||||
ifeq ($(HANDSHAKE), SSL)
|
||||
SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypto.a
|
||||
endif
|
||||
|
||||
srs_flv_parser_nossl: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_flv_parser_nossl
|
||||
ssl:
|
||||
$(MAKE) HANDSHAKE="SSL"
|
||||
nossl:
|
||||
$(MAKE) HANDSHAKE="NOSSL"
|
||||
|
||||
srs_publish_nossl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_publish_nossl
|
||||
srs_flv_parser: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_flv_parser
|
||||
|
||||
srs_play_nossl: srs_play.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_play_nossl
|
||||
srs_publish: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_publish
|
||||
|
||||
srs_ingest_flv_nossl: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_flv_nossl
|
||||
srs_play: srs_play.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_play
|
||||
|
||||
srs_ingest_rtmp_nossl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_nossl
|
||||
srs_ingest_flv: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_flv
|
||||
|
||||
srs_flv_parser_ssl: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_flv_parser_ssl
|
||||
|
||||
srs_publish_ssl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_publish_ssl
|
||||
|
||||
srs_play_ssl: srs_play.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_play_ssl
|
||||
|
||||
srs_ingest_flv_ssl: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_flv_ssl
|
||||
|
||||
srs_ingest_rtmp_ssl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_ssl
|
||||
|
||||
# alias for publish/play with/without ssl
|
||||
ssl: srs_flv_parser_ssl srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl
|
||||
nossl: srs_flv_parser_nossl srs_publish_nossl srs_play_nossl srs_ingest_flv_nossl srs_ingest_rtmp_nossl
|
||||
srs_ingest_rtmp: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp
|
||||
|
|
|
@ -48,19 +48,11 @@ int main(int argc, char** argv)
|
|||
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/livestream");
|
||||
}
|
||||
|
||||
if (1) {
|
||||
if (srs_complex_handshake(rtmp) != 0) {
|
||||
printf("complex handshake failed.\n");
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("complex handshake success\n");
|
||||
} else {
|
||||
if (srs_simple_handshake(rtmp) != 0) {
|
||||
printf("simple handshake failed.\n");
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("simple handshake success\n");
|
||||
if (srs_simple_handshake(rtmp) != 0) {
|
||||
printf("simple handshake failed.\n");
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("simple handshake success\n");
|
||||
|
||||
if (srs_connect_app(rtmp) != 0) {
|
||||
printf("connect vhost/app failed.\n");
|
||||
|
|
|
@ -45,8 +45,7 @@ int main(int argc, char** argv)
|
|||
|
||||
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/livestream");
|
||||
|
||||
//if (srs_simple_handshake(rtmp) != 0) {
|
||||
if (srs_complex_handshake(rtmp) != 0) {
|
||||
if (srs_simple_handshake(rtmp) != 0) {
|
||||
printf("simple handshake failed.\n");
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
|
|
|
@ -183,33 +183,6 @@ int srs_simple_handshake(srs_rtmp_t rtmp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_complex_handshake(srs_rtmp_t rtmp)
|
||||
{
|
||||
#ifndef SRS_AUTO_SSL
|
||||
return ERROR_RTMP_HS_SSL_REQUIRE;
|
||||
#endif
|
||||
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_assert(rtmp != NULL);
|
||||
Context* context = (Context*)rtmp;
|
||||
|
||||
// parse uri, resolve host, connect to server:port
|
||||
if ((ret = srs_librtmp_context_connect(context)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// complex handshake
|
||||
srs_freep(context->rtmp);
|
||||
context->rtmp = new SrsRtmpClient(context->skt);
|
||||
|
||||
if ((ret = context->rtmp->complex_handshake()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int srs_connect_app(srs_rtmp_t rtmp)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
|
@ -66,14 +66,6 @@ void srs_rtmp_destroy(srs_rtmp_t rtmp);
|
|||
* not depends on ssl.
|
||||
*/
|
||||
int srs_simple_handshake(srs_rtmp_t rtmp);
|
||||
/**
|
||||
* complex handshake is specified by adobe Flash player,
|
||||
* depends on ssl, user must compile srs with ssl, then
|
||||
* link user program libssl.a and libcrypt.a
|
||||
* @remark user can use srs_ssl_enabled() to detect
|
||||
* whether ssl is ok.
|
||||
*/
|
||||
int srs_complex_handshake(srs_rtmp_t rtmp);
|
||||
|
||||
/**
|
||||
* connect to rtmp vhost/app
|
||||
|
|
Loading…
Reference in a new issue