diff --git a/trunk/src/app/srs_app_http_stream.cpp b/trunk/src/app/srs_app_http_stream.cpp index 815561e1e..13db329ed 100755 --- a/trunk/src/app/srs_app_http_stream.cpp +++ b/trunk/src/app/srs_app_http_stream.cpp @@ -1132,8 +1132,8 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle // trigger edge to fetch from origin. bool vhost_is_edge = _srs_config->get_vhost_is_edge(r->vhost); - srs_trace("flv: source url=%s, is_edge=%d, source_id=%d[%d]", - r->get_stream_url().c_str(), vhost_is_edge, s->source_id(), s->source_id()); + srs_trace("flv: source url=%s, is_edge=%d, source_id=%d/%d", + r->get_stream_url().c_str(), vhost_is_edge, s->source_id(), s->pre_source_id()); return err; } diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index c7e943337..3b3a0a4c8 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -507,8 +507,8 @@ srs_error_t SrsRtmpConn::stream_service_cycle() } bool enabled_cache = _srs_config->get_gop_cache(req->vhost); - srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=%d[%d]", - req->get_stream_url().c_str(), ip.c_str(), enabled_cache, info->edge, source->source_id(), source->source_id()); + srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=%d/%d", + req->get_stream_url().c_str(), ip.c_str(), enabled_cache, info->edge, source->source_id(), source->pre_source_id()); source->set_cache(enabled_cache); switch (info->type) { diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 3473909eb..bc655cbe5 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -515,7 +515,7 @@ srs_error_t SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count) count = 0; if (should_update_source_id) { - srs_trace("update source_id=%d[%d]", source->source_id(), source->source_id()); + srs_trace("update source_id=%d/%d", source->source_id(), source->pre_source_id()); should_update_source_id = false; } @@ -1824,7 +1824,7 @@ SrsSource::SrsSource() mix_queue = new SrsMixQueue(); _can_publish = true; - _pre_source_id = _source_id = -1; + _pre_source_id = _source_id = 0; die_at = 0; play_edge = new SrsPlayEdge(); @@ -2022,13 +2022,10 @@ srs_error_t SrsSource::on_source_id_changed(int id) if (_source_id == id) { return err; } - - if (_pre_source_id == -1) { + + if (!_pre_source_id) { _pre_source_id = id; - } else if (_pre_source_id != _source_id) { - _pre_source_id = _source_id; } - _source_id = id; // notice all consumer @@ -2495,7 +2492,10 @@ void SrsSource::on_unpublish() srs_trace("cleanup when unpublish"); _can_publish = true; - _source_id = -1; + if (_source_id) { + _pre_source_id = _source_id; + } + _source_id = 0; // notify the handler. srs_assert(handler);