mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SmartPtr: Support shared ptr for live source. v6.0.129 (#4089)
Detail change log: 1. [Simple,Refactor] Remove member fields of http entry, etc.e34b3d3aa4
2. [Ignore] Rename source to live_source.846f95ec96
3. [Ignore] Use directly ptr in consumer.d38af021ad
4. [Complex, Important] Use shared ptr for live source.88f922413a
The object relationship:  --- Co-authored-by: Jacob Su <suzp1984@gmail.com>
This commit is contained in:
parent
908c2f2a30
commit
e7069788e9
30 changed files with 256 additions and 235 deletions
|
@ -646,7 +646,7 @@ srs_error_t SrsRtcPlayStream::cycle()
|
|||
|
||||
SrsRtcConsumer* consumer = NULL;
|
||||
SrsAutoFree(SrsRtcConsumer, consumer);
|
||||
if ((err = source->create_consumer(source_, consumer)) != srs_success) {
|
||||
if ((err = source->create_consumer(consumer)) != srs_success) {
|
||||
return srs_error_wrap(err, "create consumer, source=%s", req_->get_stream_url().c_str());
|
||||
}
|
||||
|
||||
|
@ -1202,8 +1202,8 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcSourceDescripti
|
|||
source_->set_publish_stream(this);
|
||||
|
||||
// TODO: FIMXE: Check it in SrsRtcConnection::add_publisher?
|
||||
SrsLiveSource *rtmp = _srs_sources->fetch(r);
|
||||
if (rtmp && !rtmp->can_publish(false)) {
|
||||
SrsSharedPtr<SrsLiveSource> live_source = _srs_sources->fetch(r);
|
||||
if (live_source.get() && !live_source->can_publish(false)) {
|
||||
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtmp stream %s busy", r->get_stream_url().c_str());
|
||||
}
|
||||
|
||||
|
@ -1227,16 +1227,16 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcSourceDescripti
|
|||
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
||||
bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req_->vhost);
|
||||
if (rtc_to_rtmp) {
|
||||
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), &rtmp)) != srs_success) {
|
||||
if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), live_source)) != srs_success) {
|
||||
return srs_error_wrap(err, "create source");
|
||||
}
|
||||
|
||||
// Disable GOP cache for RTC2RTMP bridge, to keep the streams in sync,
|
||||
// especially for stream merging.
|
||||
rtmp->set_cache(false);
|
||||
live_source->set_cache(false);
|
||||
|
||||
SrsCompositeBridge* bridge = new SrsCompositeBridge();
|
||||
bridge->append(new SrsFrameToRtmpBridge(rtmp));
|
||||
bridge->append(new SrsFrameToRtmpBridge(live_source));
|
||||
|
||||
if ((err = bridge->initialize(r)) != srs_success) {
|
||||
srs_freep(bridge);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue