mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
Fix typo, change bridger to bridge.
This commit is contained in:
parent
f469753b07
commit
f1840b87e5
7 changed files with 102 additions and 102 deletions
|
@ -1197,17 +1197,17 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest* r, SrsRtcSourceDescripti
|
||||||
return srs_error_wrap(err, "create source");
|
return srs_error_wrap(err, "create source");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable GOP cache for RTC2RTMP bridger, to keep the streams in sync,
|
// Disable GOP cache for RTC2RTMP bridge, to keep the streams in sync,
|
||||||
// especially for stream merging.
|
// especially for stream merging.
|
||||||
rtmp->set_cache(false);
|
rtmp->set_cache(false);
|
||||||
|
|
||||||
SrsRtmpFromRtcBridger *bridger = new SrsRtmpFromRtcBridger(rtmp);
|
SrsRtmpFromRtcBridge *bridge = new SrsRtmpFromRtcBridge(rtmp);
|
||||||
if ((err = bridger->initialize(r)) != srs_success) {
|
if ((err = bridge->initialize(r)) != srs_success) {
|
||||||
srs_freep(bridger);
|
srs_freep(bridge);
|
||||||
return srs_error_wrap(err, "create bridger");
|
return srs_error_wrap(err, "create bridge");
|
||||||
}
|
}
|
||||||
|
|
||||||
source->set_bridger(bridger);
|
source->set_bridge(bridge);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -316,11 +316,11 @@ ISrsRtcSourceEventHandler::~ISrsRtcSourceEventHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ISrsRtcSourceBridger::ISrsRtcSourceBridger()
|
ISrsRtcSourceBridge::ISrsRtcSourceBridge()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ISrsRtcSourceBridger::~ISrsRtcSourceBridger()
|
ISrsRtcSourceBridge::~ISrsRtcSourceBridge()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ SrsRtcSource::SrsRtcSource()
|
||||||
stream_desc_ = NULL;
|
stream_desc_ = NULL;
|
||||||
|
|
||||||
req = NULL;
|
req = NULL;
|
||||||
bridger_ = NULL;
|
bridge_ = NULL;
|
||||||
|
|
||||||
pli_for_rtmp_ = pli_elapsed_ = 0;
|
pli_for_rtmp_ = pli_elapsed_ = 0;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ SrsRtcSource::~SrsRtcSource()
|
||||||
consumers.clear();
|
consumers.clear();
|
||||||
|
|
||||||
srs_freep(req);
|
srs_freep(req);
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
srs_freep(stream_desc_);
|
srs_freep(stream_desc_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ srs_error_t SrsRtcSource::initialize(SrsRequest* r)
|
||||||
void SrsRtcSource::init_for_play_before_publishing()
|
void SrsRtcSource::init_for_play_before_publishing()
|
||||||
{
|
{
|
||||||
// If the stream description has already been setup by RTC publisher,
|
// If the stream description has already been setup by RTC publisher,
|
||||||
// we should ignore and it's ok, because we only need to setup it for bridger.
|
// we should ignore and it's ok, because we only need to setup it for bridge.
|
||||||
if (stream_desc_) {
|
if (stream_desc_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -457,10 +457,10 @@ SrsContextId SrsRtcSource::pre_source_id()
|
||||||
return _pre_source_id;
|
return _pre_source_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtcSource::set_bridger(ISrsRtcSourceBridger *bridger)
|
void SrsRtcSource::set_bridge(ISrsRtcSourceBridge *bridge)
|
||||||
{
|
{
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
bridger_ = bridger;
|
bridge_ = bridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcSource::create_consumer(SrsRtcConsumer*& consumer)
|
srs_error_t SrsRtcSource::create_consumer(SrsRtcConsumer*& consumer)
|
||||||
|
@ -504,7 +504,7 @@ void SrsRtcSource::on_consumer_destroy(SrsRtcConsumer* consumer)
|
||||||
|
|
||||||
bool SrsRtcSource::can_publish()
|
bool SrsRtcSource::can_publish()
|
||||||
{
|
{
|
||||||
// TODO: FIXME: Should check the status of bridger.
|
// TODO: FIXME: Should check the status of bridge.
|
||||||
|
|
||||||
return !is_created_;
|
return !is_created_;
|
||||||
}
|
}
|
||||||
|
@ -533,9 +533,9 @@ srs_error_t SrsRtcSource::on_publish()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If bridge to other source, handle event and start timer to request PLI.
|
// If bridge to other source, handle event and start timer to request PLI.
|
||||||
if (bridger_) {
|
if (bridge_) {
|
||||||
if ((err = bridger_->on_publish()) != srs_success) {
|
if ((err = bridge_->on_publish()) != srs_success) {
|
||||||
return srs_error_wrap(err, "bridger on publish");
|
return srs_error_wrap(err, "bridge on publish");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The PLI interval for RTC2RTMP.
|
// The PLI interval for RTC2RTMP.
|
||||||
|
@ -573,13 +573,13 @@ void SrsRtcSource::on_unpublish()
|
||||||
h->on_unpublish();
|
h->on_unpublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
//free bridger resource
|
//free bridge resource
|
||||||
if (bridger_) {
|
if (bridge_) {
|
||||||
// For SrsRtcSource::on_timer()
|
// For SrsRtcSource::on_timer()
|
||||||
_srs_hybrid->timer100ms()->unsubscribe(this);
|
_srs_hybrid->timer100ms()->unsubscribe(this);
|
||||||
|
|
||||||
bridger_->on_unpublish();
|
bridge_->on_unpublish();
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
@ -629,8 +629,8 @@ srs_error_t SrsRtcSource::on_rtp(SrsRtpPacket* pkt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bridger_ && (err = bridger_->on_rtp(pkt)) != srs_success) {
|
if (bridge_ && (err = bridge_->on_rtp(pkt)) != srs_success) {
|
||||||
return srs_error_wrap(err, "bridger consume message");
|
return srs_error_wrap(err, "bridge consume message");
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -703,7 +703,7 @@ srs_error_t SrsRtcSource::on_timer(srs_utime_t interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SRS_FFMPEG_FIT
|
#ifdef SRS_FFMPEG_FIT
|
||||||
SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
|
SrsRtcFromRtmpBridge::SrsRtcFromRtmpBridge(SrsRtcSource* source)
|
||||||
{
|
{
|
||||||
req = NULL;
|
req = NULL;
|
||||||
source_ = source;
|
source_ = source;
|
||||||
|
@ -733,14 +733,14 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtcFromRtmpBridger::~SrsRtcFromRtmpBridger()
|
SrsRtcFromRtmpBridge::~SrsRtcFromRtmpBridge()
|
||||||
{
|
{
|
||||||
srs_freep(format);
|
srs_freep(format);
|
||||||
srs_freep(codec_);
|
srs_freep(codec_);
|
||||||
srs_freep(meta);
|
srs_freep(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::initialize(SrsRequest* r)
|
srs_error_t SrsRtcFromRtmpBridge::initialize(SrsRequest* r)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ srs_error_t SrsRtcFromRtmpBridger::initialize(SrsRequest* r)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::on_publish()
|
srs_error_t SrsRtcFromRtmpBridge::on_publish()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ srs_error_t SrsRtcFromRtmpBridger::on_publish()
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: FIXME: Should sync with bridger?
|
// TODO: FIXME: Should sync with bridge?
|
||||||
if ((err = source_->on_publish()) != srs_success) {
|
if ((err = source_->on_publish()) != srs_success) {
|
||||||
return srs_error_wrap(err, "source publish");
|
return srs_error_wrap(err, "source publish");
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ srs_error_t SrsRtcFromRtmpBridger::on_publish()
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtcFromRtmpBridger::on_unpublish()
|
void SrsRtcFromRtmpBridge::on_unpublish()
|
||||||
{
|
{
|
||||||
if (!rtmp_to_rtc) {
|
if (!rtmp_to_rtc) {
|
||||||
return;
|
return;
|
||||||
|
@ -798,12 +798,12 @@ void SrsRtcFromRtmpBridger::on_unpublish()
|
||||||
meta->update_previous_vsh();
|
meta->update_previous_vsh();
|
||||||
meta->update_previous_ash();
|
meta->update_previous_ash();
|
||||||
|
|
||||||
// @remark This bridger might be disposed here, so never use it.
|
// @remark This bridge might be disposed here, so never use it.
|
||||||
// TODO: FIXME: Should sync with bridger?
|
// TODO: FIXME: Should sync with bridge?
|
||||||
source_->on_unpublish();
|
source_->on_unpublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::on_audio(SrsSharedPtrMessage* msg)
|
srs_error_t SrsRtcFromRtmpBridge::on_audio(SrsSharedPtrMessage* msg)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -860,7 +860,7 @@ srs_error_t SrsRtcFromRtmpBridger::on_audio(SrsSharedPtrMessage* msg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::transcode(SrsAudioFrame* audio)
|
srs_error_t SrsRtcFromRtmpBridge::transcode(SrsAudioFrame* audio)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -896,7 +896,7 @@ srs_error_t SrsRtcFromRtmpBridger::transcode(SrsAudioFrame* audio)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::package_opus(SrsAudioFrame* audio, SrsRtpPacket* pkt)
|
srs_error_t SrsRtcFromRtmpBridge::package_opus(SrsAudioFrame* audio, SrsRtpPacket* pkt)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_opus(SrsAudioFrame* audio, SrsRtpPack
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg)
|
srs_error_t SrsRtcFromRtmpBridge::on_video(SrsSharedPtrMessage* msg)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -998,7 +998,7 @@ srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg)
|
||||||
return consume_packets(pkts);
|
return consume_packets(pkts);
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* format, bool& has_idr, vector<SrsSample*>& samples)
|
srs_error_t SrsRtcFromRtmpBridge::filter(SrsSharedPtrMessage* msg, SrsFormat* format, bool& has_idr, vector<SrsSample*>& samples)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1028,7 +1028,7 @@ srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* f
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcSource* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt)
|
srs_error_t SrsRtcFromRtmpBridge::package_stap_a(SrsRtcSource* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcSource* source, SrsShare
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, const vector<SrsSample*>& samples, vector<SrsRtpPacket*>& pkts)
|
srs_error_t SrsRtcFromRtmpBridge::package_nalus(SrsSharedPtrMessage* msg, const vector<SrsSample*>& samples, vector<SrsRtpPacket*>& pkts)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1183,7 +1183,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single NAL Unit Packet @see https://tools.ietf.org/html/rfc6184#section-5.6
|
// Single NAL Unit Packet @see https://tools.ietf.org/html/rfc6184#section-5.6
|
||||||
srs_error_t SrsRtcFromRtmpBridger::package_single_nalu(SrsSharedPtrMessage* msg, SrsSample* sample, vector<SrsRtpPacket*>& pkts)
|
srs_error_t SrsRtcFromRtmpBridge::package_single_nalu(SrsSharedPtrMessage* msg, SrsSample* sample, vector<SrsRtpPacket*>& pkts)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1207,7 +1207,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_single_nalu(SrsSharedPtrMessage* msg,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, vector<SrsRtpPacket*>& pkts)
|
srs_error_t SrsRtcFromRtmpBridge::package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, vector<SrsRtpPacket*>& pkts)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1249,7 +1249,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_fu_a(SrsSharedPtrMessage* msg, SrsSam
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtcFromRtmpBridger::consume_packets(vector<SrsRtpPacket*>& pkts)
|
srs_error_t SrsRtcFromRtmpBridge::consume_packets(vector<SrsRtpPacket*>& pkts)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ srs_error_t SrsRtcFromRtmpBridger::consume_packets(vector<SrsRtpPacket*>& pkts)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtmpFromRtcBridger::SrsRtmpFromRtcBridger(SrsLiveSource *src)
|
SrsRtmpFromRtcBridge::SrsRtmpFromRtcBridge(SrsLiveSource *src)
|
||||||
{
|
{
|
||||||
source_ = src;
|
source_ = src;
|
||||||
codec_ = NULL;
|
codec_ = NULL;
|
||||||
|
@ -1282,14 +1282,14 @@ SrsRtmpFromRtcBridger::SrsRtmpFromRtcBridger(SrsLiveSource *src)
|
||||||
memset(cache_video_pkts_, 0, sizeof(cache_video_pkts_));
|
memset(cache_video_pkts_, 0, sizeof(cache_video_pkts_));
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRtmpFromRtcBridger::~SrsRtmpFromRtcBridger()
|
SrsRtmpFromRtcBridge::~SrsRtmpFromRtcBridge()
|
||||||
{
|
{
|
||||||
srs_freep(codec_);
|
srs_freep(codec_);
|
||||||
srs_freep(format);
|
srs_freep(format);
|
||||||
clear_cached_video();
|
clear_cached_video();
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::initialize(SrsRequest* r)
|
srs_error_t SrsRtmpFromRtcBridge::initialize(SrsRequest* r)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1312,14 +1312,14 @@ srs_error_t SrsRtmpFromRtcBridger::initialize(SrsRequest* r)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::on_publish()
|
srs_error_t SrsRtmpFromRtcBridge::on_publish()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
is_first_audio = true;
|
is_first_audio = true;
|
||||||
is_first_video = true;
|
is_first_video = true;
|
||||||
|
|
||||||
// TODO: FIXME: Should sync with bridger?
|
// TODO: FIXME: Should sync with bridge?
|
||||||
if ((err = source_->on_publish()) != srs_success) {
|
if ((err = source_->on_publish()) != srs_success) {
|
||||||
return srs_error_wrap(err, "source publish");
|
return srs_error_wrap(err, "source publish");
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1327,7 @@ srs_error_t SrsRtmpFromRtcBridger::on_publish()
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::on_rtp(SrsRtpPacket *pkt)
|
srs_error_t SrsRtmpFromRtcBridge::on_rtp(SrsRtpPacket *pkt)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1350,13 +1350,13 @@ srs_error_t SrsRtmpFromRtcBridger::on_rtp(SrsRtpPacket *pkt)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtmpFromRtcBridger::on_unpublish()
|
void SrsRtmpFromRtcBridge::on_unpublish()
|
||||||
{
|
{
|
||||||
// TODO: FIXME: Should sync with bridger?
|
// TODO: FIXME: Should sync with bridge?
|
||||||
source_->on_unpublish();
|
source_->on_unpublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::transcode_audio(SrsRtpPacket *pkt)
|
srs_error_t SrsRtmpFromRtcBridge::transcode_audio(SrsRtpPacket *pkt)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1405,7 +1405,7 @@ srs_error_t SrsRtmpFromRtcBridger::transcode_audio(SrsRtpPacket *pkt)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtmpFromRtcBridger::packet_aac(SrsCommonMessage* audio, char* data, int len, uint32_t pts, bool is_header)
|
void SrsRtmpFromRtcBridge::packet_aac(SrsCommonMessage* audio, char* data, int len, uint32_t pts, bool is_header)
|
||||||
{
|
{
|
||||||
int rtmp_len = len + 2;
|
int rtmp_len = len + 2;
|
||||||
audio->header.initialize_audio(rtmp_len, pts, 1);
|
audio->header.initialize_audio(rtmp_len, pts, 1);
|
||||||
|
@ -1422,7 +1422,7 @@ void SrsRtmpFromRtcBridger::packet_aac(SrsCommonMessage* audio, char* data, int
|
||||||
audio->size = rtmp_len;
|
audio->size = rtmp_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::packet_video(SrsRtpPacket* src)
|
srs_error_t SrsRtmpFromRtcBridge::packet_video(SrsRtpPacket* src)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1462,7 +1462,7 @@ srs_error_t SrsRtmpFromRtcBridger::packet_video(SrsRtpPacket* src)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::packet_video_key_frame(SrsRtpPacket* pkt)
|
srs_error_t SrsRtmpFromRtcBridge::packet_video_key_frame(SrsRtpPacket* pkt)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1557,7 +1557,7 @@ srs_error_t SrsRtmpFromRtcBridger::packet_video_key_frame(SrsRtpPacket* pkt)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsRtmpFromRtcBridger::packet_video_rtmp(const uint16_t start, const uint16_t end)
|
srs_error_t SrsRtmpFromRtcBridge::packet_video_rtmp(const uint16_t start, const uint16_t end)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
@ -1706,7 +1706,7 @@ srs_error_t SrsRtmpFromRtcBridger::packet_video_rtmp(const uint16_t start, const
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t SrsRtmpFromRtcBridger::find_next_lost_sn(uint16_t current_sn, uint16_t& end_sn)
|
int32_t SrsRtmpFromRtcBridge::find_next_lost_sn(uint16_t current_sn, uint16_t& end_sn)
|
||||||
{
|
{
|
||||||
uint32_t last_rtp_ts = cache_video_pkts_[cache_index(header_sn_)].rtp_ts;
|
uint32_t last_rtp_ts = cache_video_pkts_[cache_index(header_sn_)].rtp_ts;
|
||||||
for (int i = 0; i < s_cache_size; ++i) {
|
for (int i = 0; i < s_cache_size; ++i) {
|
||||||
|
@ -1732,7 +1732,7 @@ int32_t SrsRtmpFromRtcBridger::find_next_lost_sn(uint16_t current_sn, uint16_t&
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtmpFromRtcBridger::clear_cached_video()
|
void SrsRtmpFromRtcBridge::clear_cached_video()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < s_cache_size; i++)
|
for (size_t i = 0; i < s_cache_size; i++)
|
||||||
{
|
{
|
||||||
|
@ -1746,7 +1746,7 @@ void SrsRtmpFromRtcBridger::clear_cached_video()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsRtmpFromRtcBridger::check_frame_complete(const uint16_t start, const uint16_t end)
|
bool SrsRtmpFromRtcBridge::check_frame_complete(const uint16_t start, const uint16_t end)
|
||||||
{
|
{
|
||||||
int16_t cnt = srs_rtp_seq_distance(start, end) + 1;
|
int16_t cnt = srs_rtp_seq_distance(start, end) + 1;
|
||||||
srs_assert(cnt >= 1);
|
srs_assert(cnt >= 1);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class SrsSharedPtrMessage;
|
||||||
class SrsCommonMessage;
|
class SrsCommonMessage;
|
||||||
class SrsMessageArray;
|
class SrsMessageArray;
|
||||||
class SrsRtcSource;
|
class SrsRtcSource;
|
||||||
class SrsRtcFromRtmpBridger;
|
class SrsRtcFromRtmpBridge;
|
||||||
class SrsAudioTranscoder;
|
class SrsAudioTranscoder;
|
||||||
class SrsRtpPacket;
|
class SrsRtpPacket;
|
||||||
class SrsSample;
|
class SrsSample;
|
||||||
|
@ -144,11 +144,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// SrsRtcSource bridge to SrsLiveSource
|
// SrsRtcSource bridge to SrsLiveSource
|
||||||
class ISrsRtcSourceBridger
|
class ISrsRtcSourceBridge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ISrsRtcSourceBridger();
|
ISrsRtcSourceBridge();
|
||||||
virtual ~ISrsRtcSourceBridger();
|
virtual ~ISrsRtcSourceBridge();
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t on_publish() = 0;
|
virtual srs_error_t on_publish() = 0;
|
||||||
virtual srs_error_t on_rtp(SrsRtpPacket *pkt) = 0;
|
virtual srs_error_t on_rtp(SrsRtpPacket *pkt) = 0;
|
||||||
|
@ -170,8 +170,8 @@ private:
|
||||||
ISrsRtcPublishStream* publish_stream_;
|
ISrsRtcPublishStream* publish_stream_;
|
||||||
// Steam description for this steam.
|
// Steam description for this steam.
|
||||||
SrsRtcSourceDescription* stream_desc_;
|
SrsRtcSourceDescription* stream_desc_;
|
||||||
// The Source bridger, bridger stream to other source.
|
// The Source bridge, bridge stream to other source.
|
||||||
ISrsRtcSourceBridger* bridger_;
|
ISrsRtcSourceBridge* bridge_;
|
||||||
private:
|
private:
|
||||||
// To delivery stream to clients.
|
// To delivery stream to clients.
|
||||||
std::vector<SrsRtcConsumer*> consumers;
|
std::vector<SrsRtcConsumer*> consumers;
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
virtual SrsContextId source_id();
|
virtual SrsContextId source_id();
|
||||||
virtual SrsContextId pre_source_id();
|
virtual SrsContextId pre_source_id();
|
||||||
public:
|
public:
|
||||||
void set_bridger(ISrsRtcSourceBridger *bridger);
|
void set_bridge(ISrsRtcSourceBridge *bridge);
|
||||||
public:
|
public:
|
||||||
// Create consumer
|
// Create consumer
|
||||||
// @param consumer, output the create consumer.
|
// @param consumer, output the create consumer.
|
||||||
|
@ -243,7 +243,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SRS_FFMPEG_FIT
|
#ifdef SRS_FFMPEG_FIT
|
||||||
class SrsRtcFromRtmpBridger : public ISrsLiveSourceBridger
|
class SrsRtcFromRtmpBridge : public ISrsLiveSourceBridge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SrsRequest* req;
|
SrsRequest* req;
|
||||||
|
@ -262,8 +262,8 @@ private:
|
||||||
uint32_t audio_ssrc;
|
uint32_t audio_ssrc;
|
||||||
uint32_t video_ssrc;
|
uint32_t video_ssrc;
|
||||||
public:
|
public:
|
||||||
SrsRtcFromRtmpBridger(SrsRtcSource* source);
|
SrsRtcFromRtmpBridge(SrsRtcSource* source);
|
||||||
virtual ~SrsRtcFromRtmpBridger();
|
virtual ~SrsRtcFromRtmpBridge();
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t initialize(SrsRequest* r);
|
virtual srs_error_t initialize(SrsRequest* r);
|
||||||
virtual srs_error_t on_publish();
|
virtual srs_error_t on_publish();
|
||||||
|
@ -283,7 +283,7 @@ private:
|
||||||
srs_error_t consume_packets(std::vector<SrsRtpPacket*>& pkts);
|
srs_error_t consume_packets(std::vector<SrsRtpPacket*>& pkts);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SrsRtmpFromRtcBridger : public ISrsRtcSourceBridger
|
class SrsRtmpFromRtcBridge : public ISrsRtcSourceBridge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SrsLiveSource *source_;
|
SrsLiveSource *source_;
|
||||||
|
@ -308,8 +308,8 @@ private:
|
||||||
uint16_t lost_sn_;
|
uint16_t lost_sn_;
|
||||||
int64_t rtp_key_frame_ts_;
|
int64_t rtp_key_frame_ts_;
|
||||||
public:
|
public:
|
||||||
SrsRtmpFromRtcBridger(SrsLiveSource *src);
|
SrsRtmpFromRtcBridge(SrsLiveSource *src);
|
||||||
virtual ~SrsRtmpFromRtcBridger();
|
virtual ~SrsRtmpFromRtcBridge();
|
||||||
public:
|
public:
|
||||||
srs_error_t initialize(SrsRequest* r);
|
srs_error_t initialize(SrsRequest* r);
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -970,13 +970,13 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
|
||||||
// Bridge to RTC streaming.
|
// Bridge to RTC streaming.
|
||||||
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT)
|
||||||
if (rtc) {
|
if (rtc) {
|
||||||
SrsRtcFromRtmpBridger *bridger = new SrsRtcFromRtmpBridger(rtc);
|
SrsRtcFromRtmpBridge *bridge = new SrsRtcFromRtmpBridge(rtc);
|
||||||
if ((err = bridger->initialize(req)) != srs_success) {
|
if ((err = bridge->initialize(req)) != srs_success) {
|
||||||
srs_freep(bridger);
|
srs_freep(bridge);
|
||||||
return srs_error_wrap(err, "bridger init");
|
return srs_error_wrap(err, "bridge init");
|
||||||
}
|
}
|
||||||
|
|
||||||
source->set_bridger(bridger);
|
source->set_bridge(bridge);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1909,11 +1909,11 @@ void SrsLiveSourceManager::destroy()
|
||||||
pool.clear();
|
pool.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ISrsLiveSourceBridger::ISrsLiveSourceBridger()
|
ISrsLiveSourceBridge::ISrsLiveSourceBridge()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ISrsLiveSourceBridger::~ISrsLiveSourceBridger()
|
ISrsLiveSourceBridge::~ISrsLiveSourceBridge()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1928,7 +1928,7 @@ SrsLiveSource::SrsLiveSource()
|
||||||
die_at = 0;
|
die_at = 0;
|
||||||
|
|
||||||
handler = NULL;
|
handler = NULL;
|
||||||
bridger_ = NULL;
|
bridge_ = NULL;
|
||||||
|
|
||||||
play_edge = new SrsPlayEdge();
|
play_edge = new SrsPlayEdge();
|
||||||
publish_edge = new SrsPublishEdge();
|
publish_edge = new SrsPublishEdge();
|
||||||
|
@ -1960,7 +1960,7 @@ SrsLiveSource::~SrsLiveSource()
|
||||||
srs_freep(gop_cache);
|
srs_freep(gop_cache);
|
||||||
|
|
||||||
srs_freep(req);
|
srs_freep(req);
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsLiveSource::dispose()
|
void SrsLiveSource::dispose()
|
||||||
|
@ -2036,10 +2036,10 @@ srs_error_t SrsLiveSource::initialize(SrsRequest* r, ISrsLiveSourceHandler* h)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsLiveSource::set_bridger(ISrsLiveSourceBridger* v)
|
void SrsLiveSource::set_bridge(ISrsLiveSourceBridge* v)
|
||||||
{
|
{
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
bridger_ = v;
|
bridge_ = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsLiveSource::on_reload_vhost_play(string vhost)
|
srs_error_t SrsLiveSource::on_reload_vhost_play(string vhost)
|
||||||
|
@ -2170,7 +2170,7 @@ void SrsLiveSource::update_auth(SrsRequest* r)
|
||||||
|
|
||||||
bool SrsLiveSource::can_publish(bool is_edge)
|
bool SrsLiveSource::can_publish(bool is_edge)
|
||||||
{
|
{
|
||||||
// TODO: FIXME: Should check the status of bridger.
|
// TODO: FIXME: Should check the status of bridge.
|
||||||
|
|
||||||
if (is_edge) {
|
if (is_edge) {
|
||||||
return publish_edge->can_publish();
|
return publish_edge->can_publish();
|
||||||
|
@ -2291,9 +2291,9 @@ srs_error_t SrsLiveSource::on_audio_imp(SrsSharedPtrMessage* msg)
|
||||||
return srs_error_wrap(err, "consume audio");
|
return srs_error_wrap(err, "consume audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
// For bridger to consume the message.
|
// For bridge to consume the message.
|
||||||
if (bridger_ && (err = bridger_->on_audio(msg)) != srs_success) {
|
if (bridge_ && (err = bridge_->on_audio(msg)) != srs_success) {
|
||||||
return srs_error_wrap(err, "bridger consume audio");
|
return srs_error_wrap(err, "bridge consume audio");
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to all consumer
|
// copy to all consumer
|
||||||
|
@ -2421,9 +2421,9 @@ srs_error_t SrsLiveSource::on_video_imp(SrsSharedPtrMessage* msg)
|
||||||
return srs_error_wrap(err, "hub consume video");
|
return srs_error_wrap(err, "hub consume video");
|
||||||
}
|
}
|
||||||
|
|
||||||
// For bridger to consume the message.
|
// For bridge to consume the message.
|
||||||
if (bridger_ && (err = bridger_->on_video(msg)) != srs_success) {
|
if (bridge_ && (err = bridge_->on_video(msg)) != srs_success) {
|
||||||
return srs_error_wrap(err, "bridger consume video");
|
return srs_error_wrap(err, "bridge consume video");
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to all consumer
|
// copy to all consumer
|
||||||
|
@ -2586,8 +2586,8 @@ srs_error_t SrsLiveSource::on_publish()
|
||||||
return srs_error_wrap(err, "handle publish");
|
return srs_error_wrap(err, "handle publish");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bridger_ && (err = bridger_->on_publish()) != srs_success) {
|
if (bridge_ && (err = bridge_->on_publish()) != srs_success) {
|
||||||
return srs_error_wrap(err, "bridger publish");
|
return srs_error_wrap(err, "bridge publish");
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
@ -2631,9 +2631,9 @@ void SrsLiveSource::on_unpublish()
|
||||||
|
|
||||||
handler->on_unpublish(this, req);
|
handler->on_unpublish(this, req);
|
||||||
|
|
||||||
if (bridger_) {
|
if (bridge_) {
|
||||||
bridger_->on_unpublish();
|
bridge_->on_unpublish();
|
||||||
srs_freep(bridger_);
|
srs_freep(bridge_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no consumer, stream is die.
|
// no consumer, stream is die.
|
||||||
|
|
|
@ -469,11 +469,11 @@ public:
|
||||||
extern SrsLiveSourceManager* _srs_sources;
|
extern SrsLiveSourceManager* _srs_sources;
|
||||||
|
|
||||||
// For RTMP2RTC, bridge SrsLiveSource to SrsRtcSource
|
// For RTMP2RTC, bridge SrsLiveSource to SrsRtcSource
|
||||||
class ISrsLiveSourceBridger
|
class ISrsLiveSourceBridge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ISrsLiveSourceBridger();
|
ISrsLiveSourceBridge();
|
||||||
virtual ~ISrsLiveSourceBridger();
|
virtual ~ISrsLiveSourceBridge();
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t on_publish() = 0;
|
virtual srs_error_t on_publish() = 0;
|
||||||
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio) = 0;
|
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio) = 0;
|
||||||
|
@ -514,8 +514,8 @@ private:
|
||||||
int64_t last_packet_time;
|
int64_t last_packet_time;
|
||||||
// The event handler.
|
// The event handler.
|
||||||
ISrsLiveSourceHandler* handler;
|
ISrsLiveSourceHandler* handler;
|
||||||
// The source bridger for other source.
|
// The source bridge for other source.
|
||||||
ISrsLiveSourceBridger* bridger_;
|
ISrsLiveSourceBridge* bridge_;
|
||||||
// The edge control service
|
// The edge control service
|
||||||
SrsPlayEdge* play_edge;
|
SrsPlayEdge* play_edge;
|
||||||
SrsPublishEdge* publish_edge;
|
SrsPublishEdge* publish_edge;
|
||||||
|
@ -543,7 +543,7 @@ public:
|
||||||
// Initialize the hls with handlers.
|
// Initialize the hls with handlers.
|
||||||
virtual srs_error_t initialize(SrsRequest* r, ISrsLiveSourceHandler* h);
|
virtual srs_error_t initialize(SrsRequest* r, ISrsLiveSourceHandler* h);
|
||||||
// Bridge to other source, forward packets to it.
|
// Bridge to other source, forward packets to it.
|
||||||
void set_bridger(ISrsLiveSourceBridger* v);
|
void set_bridge(ISrsLiveSourceBridge* v);
|
||||||
// Interface ISrsReloadHandler
|
// Interface ISrsReloadHandler
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t on_reload_vhost_play(std::string vhost);
|
virtual srs_error_t on_reload_vhost_play(std::string vhost);
|
||||||
|
|
|
@ -286,7 +286,7 @@ private:
|
||||||
public:
|
public:
|
||||||
// The first byte as nalu type, for video decoder only.
|
// The first byte as nalu type, for video decoder only.
|
||||||
SrsAvcNaluType nalu_type;
|
SrsAvcNaluType nalu_type;
|
||||||
// The frame type, for RTMP bridger or SFU source.
|
// The frame type, for RTMP bridge or SFU source.
|
||||||
SrsFrameType frame_type;
|
SrsFrameType frame_type;
|
||||||
// Fast cache for performance.
|
// Fast cache for performance.
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue