Skip to content

Commit a28f985

Browse files
committed
Refine cid for source
1 parent 365d3b8 commit a28f985

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

trunk/src/app/srs_app_rtc_conn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ srs_error_t SrsRtcPlayStream::cycle()
543543

544544
// TODO: FIXME: Add cost in ms.
545545
SrsContextId cid = source->source_id();
546-
srs_trace("RTC: start play url=%s, source_id=[%d][%s], realtime=%d, mw_msgs=%d", req_->get_stream_url().c_str(),
547-
::getpid(), cid.c_str(), realtime, mw_msgs);
546+
srs_trace("RTC: start play url=%s, source_id=%s/%s, realtime=%d, mw_msgs=%d", req_->get_stream_url().c_str(),
547+
cid.c_str(), source->pre_source_id().c_str(), realtime, mw_msgs);
548548

549549
SrsErrorPithyPrint* epp = new SrsErrorPithyPrint();
550550
SrsAutoFree(SrsErrorPithyPrint, epp);

trunk/src/app/srs_app_rtc_source.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ srs_error_t SrsRtcConsumer::dump_packets(std::vector<SrsRtpPacket2*>& pkts)
187187
srs_error_t err = srs_success;
188188

189189
if (should_update_source_id) {
190-
srs_trace("update source_id=%s[%s]", source->source_id().c_str(), source->source_id().c_str());
190+
srs_trace("update source_id=%s/%s", source->source_id().c_str(), source->pre_source_id().c_str());
191191
should_update_source_id = false;
192192
}
193193

@@ -356,10 +356,7 @@ srs_error_t SrsRtcStream::on_source_id_changed(SrsContextId id)
356356

357357
if (_pre_source_id.empty()) {
358358
_pre_source_id = id;
359-
} else if (_pre_source_id.compare(_source_id)) {
360-
_pre_source_id = _source_id;
361359
}
362-
363360
_source_id = id;
364361

365362
// notice all consumer
@@ -472,6 +469,9 @@ void SrsRtcStream::on_unpublish()
472469
is_created_ = false;
473470
is_delivering_packets_ = false;
474471

472+
if (!_source_id.empty()) {
473+
_pre_source_id = _source_id;
474+
}
475475
_source_id = SrsContextId();
476476

477477
for (size_t i = 0; i < event_handlers_.size(); i++) {

trunk/src/app/srs_app_source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2555,10 +2555,10 @@ void SrsSource::on_unpublish()
25552555
srs_trace("cleanup when unpublish");
25562556

25572557
_can_publish = true;
2558-
_source_id = SrsContextId();
25592558
if (!_source_id.empty()) {
25602559
_pre_source_id = _source_id;
25612560
}
2561+
_source_id = SrsContextId();
25622562

25632563
// notify the handler.
25642564
srs_assert(handler);

0 commit comments

Comments
 (0)