Skip to content

Commit

Permalink
SRT: fix crash when srt_to_rtmp off
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhihong committed Jan 17, 2023
1 parent 39c2b9c commit 703f0ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions trunk/src/app/srs_app_srt_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ srs_error_t SrsSrtSource::on_publish()
return srs_error_wrap(err, "source id change");
}

if ((err = bridge_->on_publish()) != srs_success) {
if (bridge_ && (err = bridge_->on_publish()) != srs_success) {
return srs_error_wrap(err, "bridge on publish");
}

Expand All @@ -787,7 +787,9 @@ void SrsSrtSource::on_unpublish()

can_publish_ = true;

bridge_->on_unpublish();
if (bridge_) {
bridge_->on_unpublish();
}
srs_freep(bridge_);
}

Expand All @@ -802,7 +804,7 @@ srs_error_t SrsSrtSource::on_packet(SrsSrtPacket* packet)
}
}

if ((err = bridge_->on_packet(packet)) != srs_success) {
if (bridge_ && (err = bridge_->on_packet(packet)) != srs_success) {
return srs_error_wrap(err, "bridge consume message");
}

Expand Down

0 comments on commit 703f0ad

Please sign in to comment.