winlin

Merge branch '2.0release' into develop

@@ -167,7 +167,7 @@ PROTOCOL_OBJS="${MODULE_OBJS[@]}" @@ -167,7 +167,7 @@ PROTOCOL_OBJS="${MODULE_OBJS[@]}"
167 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then 167 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
168 MODULE_ID="APP" 168 MODULE_ID="APP"
169 MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL") 169 MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
170 - ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS_DIR}) 170 + ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${LibSSLRoot} ${SRS_OBJS_DIR})
171 MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source" 171 MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
172 "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream" 172 "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
173 "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" 173 "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config"
@@ -200,7 +200,7 @@ LIBS_OBJS="${MODULE_OBJS[@]}" @@ -200,7 +200,7 @@ LIBS_OBJS="${MODULE_OBJS[@]}"
200 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then 200 if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
201 MODULE_ID="MAIN" 201 MODULE_ID="MAIN"
202 MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") 202 MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
203 - ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot}) 203 + ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot} ${LibSSLRoot})
204 MODULE_FILES=("srs_main_server" "srs_main_ingest_hls") 204 MODULE_FILES=("srs_main_server" "srs_main_ingest_hls")
205 # add each modules for main 205 # add each modules for main
206 for SRS_MODULE in ${SRS_MODULES[*]}; do 206 for SRS_MODULE in ${SRS_MODULES[*]}; do
@@ -455,14 +455,6 @@ int SrsRtmpConn::stream_service_cycle() @@ -455,14 +455,6 @@ int SrsRtmpConn::stream_service_cycle()
455 case SrsRtmpConnPlay: { 455 case SrsRtmpConnPlay: {
456 srs_verbose("start to play stream %s.", req->stream.c_str()); 456 srs_verbose("start to play stream %s.", req->stream.c_str());
457 457
458 - if (vhost_is_edge) {  
459 - // notice edge to start for the first client.  
460 - if ((ret = source->on_edge_start_play()) != ERROR_SUCCESS) {  
461 - srs_error("notice edge start play stream failed. ret=%d", ret);  
462 - return ret;  
463 - }  
464 - }  
465 -  
466 // response connection start play 458 // response connection start play
467 if ((ret = rtmp->start_play(res->stream_id)) != ERROR_SUCCESS) { 459 if ((ret = rtmp->start_play(res->stream_id)) != ERROR_SUCCESS) {
468 srs_error("start to play stream failed. ret=%d", ret); 460 srs_error("start to play stream failed. ret=%d", ret);
@@ -482,13 +474,6 @@ int SrsRtmpConn::stream_service_cycle() @@ -482,13 +474,6 @@ int SrsRtmpConn::stream_service_cycle()
482 case SrsRtmpConnFMLEPublish: { 474 case SrsRtmpConnFMLEPublish: {
483 srs_verbose("FMLE start to publish stream %s.", req->stream.c_str()); 475 srs_verbose("FMLE start to publish stream %s.", req->stream.c_str());
484 476
485 - if (vhost_is_edge) {  
486 - if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {  
487 - srs_error("notice edge start publish stream failed. ret=%d", ret);  
488 - return ret;  
489 - }  
490 - }  
491 -  
492 if ((ret = rtmp->start_fmle_publish(res->stream_id)) != ERROR_SUCCESS) { 477 if ((ret = rtmp->start_fmle_publish(res->stream_id)) != ERROR_SUCCESS) {
493 srs_error("start to publish stream failed. ret=%d", ret); 478 srs_error("start to publish stream failed. ret=%d", ret);
494 return ret; 479 return ret;
@@ -511,13 +496,6 @@ int SrsRtmpConn::stream_service_cycle() @@ -511,13 +496,6 @@ int SrsRtmpConn::stream_service_cycle()
511 case SrsRtmpConnFlashPublish: { 496 case SrsRtmpConnFlashPublish: {
512 srs_verbose("flash start to publish stream %s.", req->stream.c_str()); 497 srs_verbose("flash start to publish stream %s.", req->stream.c_str());
513 498
514 - if (vhost_is_edge) {  
515 - if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {  
516 - srs_error("notice edge start publish stream failed. ret=%d", ret);  
517 - return ret;  
518 - }  
519 - }  
520 -  
521 if ((ret = rtmp->start_flash_publish(res->stream_id)) != ERROR_SUCCESS) { 499 if ((ret = rtmp->start_flash_publish(res->stream_id)) != ERROR_SUCCESS) {
522 srs_error("flash start to publish stream failed. ret=%d", ret); 500 srs_error("flash start to publish stream failed. ret=%d", ret);
523 return ret; 501 return ret;
@@ -596,6 +574,14 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -596,6 +574,14 @@ int SrsRtmpConn::playing(SrsSource* source)
596 } 574 }
597 SrsAutoFree(SrsConsumer, consumer); 575 SrsAutoFree(SrsConsumer, consumer);
598 srs_verbose("consumer created success."); 576 srs_verbose("consumer created success.");
  577 +
  578 + if (_srs_config->get_vhost_is_edge(req->vhost)) {
  579 + // notice edge to start for the first client.
  580 + if ((ret = source->on_edge_start_play()) != ERROR_SUCCESS) {
  581 + srs_error("notice edge start play stream failed. ret=%d", ret);
  582 + return ret;
  583 + }
  584 + }
599 585
600 // use isolate thread to recv, 586 // use isolate thread to recv,
601 // @see: https://github.com/simple-rtmp-server/srs/issues/217 587 // @see: https://github.com/simple-rtmp-server/srs/issues/217
@@ -874,6 +860,11 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd) @@ -874,6 +860,11 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd)
874 return ret; 860 return ret;
875 } 861 }
876 srs_verbose("hls on_publish success."); 862 srs_verbose("hls on_publish success.");
  863 + } else {
  864 + if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {
  865 + srs_error("notice edge start publish stream failed. ret=%d", ret);
  866 + return ret;
  867 + }
877 } 868 }
878 869
879 // start isolate recv thread. 870 // start isolate recv thread.