mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SmartPtr: Use shared ptr in RTC TCP connection. v6.0.127 (#4083)
Fix issue https://github.com/ossrs/srs/issues/3784 --- Co-authored-by: Jacob Su <suzp1984@gmail.com>
This commit is contained in:
parent
7b9c52b283
commit
242152bd6b
10 changed files with 95 additions and 76 deletions
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <srs_app_source.hpp>
|
||||
#include <srs_protocol_format.hpp>
|
||||
#include <srs_app_rtc_codec.hpp>
|
||||
#include <srs_app_rtc_source.hpp>
|
||||
#include <srs_app_config.hpp>
|
||||
#include <srs_protocol_rtmp_stack.hpp>
|
||||
|
@ -63,13 +62,12 @@ srs_error_t SrsFrameToRtmpBridge::on_frame(SrsSharedPtrMessage* frame)
|
|||
return source_->on_frame(frame);
|
||||
}
|
||||
|
||||
#ifdef SRS_RTC
|
||||
SrsFrameToRtcBridge::SrsFrameToRtcBridge(SrsRtcSource* source)
|
||||
{
|
||||
#ifdef SRS_RTC
|
||||
source_ = source;
|
||||
#endif
|
||||
|
||||
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
||||
#if defined(SRS_FFMPEG_FIT)
|
||||
uint32_t audio_ssrc = 0;
|
||||
uint8_t audio_payload_type = 0;
|
||||
uint32_t video_ssrc = 0;
|
||||
|
@ -119,12 +117,10 @@ srs_error_t SrsFrameToRtcBridge::on_publish()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
#ifdef SRS_RTC
|
||||
// TODO: FIXME: Should sync with bridge?
|
||||
if ((err = source_->on_publish()) != srs_success) {
|
||||
return srs_error_wrap(err, "source publish");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SRS_FFMPEG_FIT
|
||||
if ((err = rtp_builder_->on_publish()) != srs_success) {
|
||||
|
@ -141,11 +137,9 @@ void SrsFrameToRtcBridge::on_unpublish()
|
|||
rtp_builder_->on_unpublish();
|
||||
#endif
|
||||
|
||||
#ifdef SRS_RTC
|
||||
// @remark This bridge might be disposed here, so never use it.
|
||||
// TODO: FIXME: Should sync with bridge?
|
||||
source_->on_unpublish();
|
||||
#endif
|
||||
}
|
||||
|
||||
srs_error_t SrsFrameToRtcBridge::on_frame(SrsSharedPtrMessage* frame)
|
||||
|
@ -159,12 +153,9 @@ srs_error_t SrsFrameToRtcBridge::on_frame(SrsSharedPtrMessage* frame)
|
|||
|
||||
srs_error_t SrsFrameToRtcBridge::on_rtp(SrsRtpPacket* pkt)
|
||||
{
|
||||
#ifdef SRS_RTC
|
||||
return source_->on_rtp(pkt);
|
||||
#else
|
||||
return srs_success;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
SrsCompositeBridge::SrsCompositeBridge()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue