1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refine cid for source

This commit is contained in:
winlin 2020-10-31 22:04:53 +08:00
parent 365d3b8bda
commit a28f98581e
3 changed files with 7 additions and 7 deletions

View file

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

View file

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

View file

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