From b4ff9cfba16e3c6816b55ecf0952b28233353526 Mon Sep 17 00:00:00 2001 From: zhengfl Date: Wed, 17 Jun 2015 23:09:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=E6=9F=90=E7=A7=8D=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=BD=93=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=96=AD=E5=BC=80=E5=90=8E=EF=BC=8C=E8=BE=B9?= =?UTF-8?q?=E7=BC=98=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9B=9E=E6=BA=90=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=EF=BC=88EdgeIngester/EdgeForwarder=EF=BC=89=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A2=AB=E6=96=AD=E5=BC=80=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/src/app/srs_app_rtmp_conn.cpp | 36 +++++++++++------------------ 1 file changed, 14 insertions(+), 22 deletions(-) mode change 100644 => 100755 trunk/src/app/srs_app_rtmp_conn.cpp diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp old mode 100644 new mode 100755 index a199a17f7..c639726af --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -455,14 +455,6 @@ int SrsRtmpConn::stream_service_cycle() case SrsRtmpConnPlay: { srs_verbose("start to play stream %s.", req->stream.c_str()); - if (vhost_is_edge) { - // notice edge to start for the first client. - if ((ret = source->on_edge_start_play()) != ERROR_SUCCESS) { - srs_error("notice edge start play stream failed. ret=%d", ret); - return ret; - } - } - // response connection start play if ((ret = rtmp->start_play(res->stream_id)) != ERROR_SUCCESS) { srs_error("start to play stream failed. ret=%d", ret); @@ -482,13 +474,6 @@ int SrsRtmpConn::stream_service_cycle() case SrsRtmpConnFMLEPublish: { srs_verbose("FMLE start to publish stream %s.", req->stream.c_str()); - if (vhost_is_edge) { - if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) { - srs_error("notice edge start publish stream failed. ret=%d", ret); - return ret; - } - } - if ((ret = rtmp->start_fmle_publish(res->stream_id)) != ERROR_SUCCESS) { srs_error("start to publish stream failed. ret=%d", ret); return ret; @@ -511,13 +496,6 @@ int SrsRtmpConn::stream_service_cycle() case SrsRtmpConnFlashPublish: { srs_verbose("flash start to publish stream %s.", req->stream.c_str()); - if (vhost_is_edge) { - if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) { - srs_error("notice edge start publish stream failed. ret=%d", ret); - return ret; - } - } - if ((ret = rtmp->start_flash_publish(res->stream_id)) != ERROR_SUCCESS) { srs_error("flash start to publish stream failed. ret=%d", ret); return ret; @@ -596,6 +574,14 @@ int SrsRtmpConn::playing(SrsSource* source) } SrsAutoFree(SrsConsumer, consumer); srs_verbose("consumer created success."); + + if (_srs_config->get_vhost_is_edge(req->vhost)) { + // notice edge to start for the first client. + if ((ret = source->on_edge_start_play()) != ERROR_SUCCESS) { + srs_error("notice edge start play stream failed. ret=%d", ret); + return ret; + } + } // use isolate thread to recv, // @see: https://github.com/simple-rtmp-server/srs/issues/217 @@ -875,6 +861,12 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd) } srs_verbose("hls on_publish success."); } + else { + if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) { + srs_error("notice edge start publish stream failed. ret=%d", ret); + return ret; + } + } // start isolate recv thread. if ((ret = trd->start()) != ERROR_SUCCESS) {