Skip to content

Commit

Permalink
Dispose source when no publishers.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jun 13, 2024
1 parent e1aeccb commit 05dbbbe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions trunk/src/app/srs_app_srt_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,8 @@ void SrsSrtSource::on_consumer_destroy(SrsSrtConsumer* consumer)
it = consumers.erase(it);
}

// Destroy and cleanup source when no consumers.
if (consumers.empty()) {
// Destroy and cleanup source when no publishers and consumers.
if (can_publish_ && consumers.empty()) {
_srs_srt_sources->eliminate(req);
}
}
Expand Down Expand Up @@ -1027,6 +1027,11 @@ void SrsSrtSource::on_unpublish()
bridge_->on_unpublish();
srs_freep(bridge_);
}

// Destroy and cleanup source when no publishers and consumers.
if (can_publish_ && consumers.empty()) {
_srs_srt_sources->eliminate(req);
}
}

srs_error_t SrsSrtSource::on_packet(SrsSrtPacket* packet)
Expand Down

0 comments on commit 05dbbbe

Please sign in to comment.