Refine cid for source

pull/2011/head
winlin 4 years ago
parent 365d3b8bda
commit a28f98581e

@ -543,8 +543,8 @@ srs_error_t SrsRtcPlayStream::cycle()
// TODO: FIXME: Add cost in ms.
SrsContextId cid = source->source_id();
srs_trace("RTC: start play url=%s, source_id=[%d][%s], realtime=%d, mw_msgs=%d", req_->get_stream_url().c_str(),
::getpid(), cid.c_str(), realtime, mw_msgs);
srs_trace("RTC: start play url=%s, source_id=%s/%s, realtime=%d, mw_msgs=%d", req_->get_stream_url().c_str(),
cid.c_str(), source->pre_source_id().c_str(), realtime, mw_msgs);
SrsErrorPithyPrint* epp = new SrsErrorPithyPrint();
SrsAutoFree(SrsErrorPithyPrint, epp);

@ -187,7 +187,7 @@ srs_error_t SrsRtcConsumer::dump_packets(std::vector<SrsRtpPacket2*>& pkts)
srs_error_t err = srs_success;
if (should_update_source_id) {
srs_trace("update source_id=%s[%s]", source->source_id().c_str(), source->source_id().c_str());
srs_trace("update source_id=%s/%s", source->source_id().c_str(), source->pre_source_id().c_str());
should_update_source_id = false;
}
@ -356,10 +356,7 @@ srs_error_t SrsRtcStream::on_source_id_changed(SrsContextId id)
if (_pre_source_id.empty()) {
_pre_source_id = id;
} else if (_pre_source_id.compare(_source_id)) {
_pre_source_id = _source_id;
}
_source_id = id;
// notice all consumer
@ -472,6 +469,9 @@ void SrsRtcStream::on_unpublish()
is_created_ = false;
is_delivering_packets_ = false;
if (!_source_id.empty()) {
_pre_source_id = _source_id;
}
_source_id = SrsContextId();
for (size_t i = 0; i < event_handlers_.size(); i++) {

@ -2555,10 +2555,10 @@ void SrsSource::on_unpublish()
srs_trace("cleanup when unpublish");
_can_publish = true;
_source_id = SrsContextId();
if (!_source_id.empty()) {
_pre_source_id = _source_id;
}
_source_id = SrsContextId();
// notify the handler.
srs_assert(handler);

Loading…
Cancel
Save