1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Support build without RTMP2RTC bridger, no FFmpeg fit.

This commit is contained in:
winlin 2020-06-24 12:44:13 +08:00
parent ab6bc39676
commit be5d76009e
7 changed files with 117 additions and 19 deletions

View file

@ -247,7 +247,11 @@ SrsRtcSource::SrsRtcSource()
rtc_publisher_ = NULL;
req = NULL;
#ifdef SRS_FFMPEG_FIT
bridger_ = new SrsRtcFromRtmpBridger(this);
#else
bridger_ = new SrsRtcDummyBridger();
#endif
}
SrsRtcSource::~SrsRtcSource()
@ -266,9 +270,12 @@ srs_error_t SrsRtcSource::initialize(SrsRequest* r)
req = r->copy();
if ((err = bridger_->initialize(req)) != srs_success) {
#ifdef SRS_FFMPEG_FIT
SrsRtcFromRtmpBridger* bridger = dynamic_cast<SrsRtcFromRtmpBridger*>(bridger_);
if ((err = bridger->initialize(req)) != srs_success) {
return srs_error_wrap(err, "bridge initialize");
}
#endif
return err;
}
@ -414,6 +421,7 @@ srs_error_t SrsRtcSource::on_rtp(SrsRtpPacket2* pkt)
return err;
}
#ifdef SRS_FFMPEG_FIT
SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
{
req = NULL;
@ -936,4 +944,32 @@ srs_error_t SrsRtcFromRtmpBridger::consume_packets(vector<SrsRtpPacket2*>& pkts)
return err;
}
#endif
SrsRtcDummyBridger::SrsRtcDummyBridger()
{
}
SrsRtcDummyBridger::~SrsRtcDummyBridger()
{
}
srs_error_t SrsRtcDummyBridger::on_publish()
{
return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
}
srs_error_t SrsRtcDummyBridger::on_audio(SrsSharedPtrMessage* /*audio*/)
{
return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
}
srs_error_t SrsRtcDummyBridger::on_video(SrsSharedPtrMessage* /*video*/)
{
return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
}
void SrsRtcDummyBridger::on_unpublish()
{
}

View file

@ -115,7 +115,7 @@ private:
SrsRequest* req;
ISrsRtcPublisher* rtc_publisher_;
// Transmux RTMP to RTC.
SrsRtcFromRtmpBridger* bridger_;
ISrsSourceBridger* bridger_;
private:
// To delivery stream to clients.
std::vector<SrsRtcConsumer*> consumers;
@ -159,6 +159,7 @@ public:
srs_error_t on_rtp(SrsRtpPacket2* pkt);
};
#ifdef SRS_FFMPEG_FIT
class SrsRtcFromRtmpBridger : public ISrsSourceBridger
{
private:
@ -197,6 +198,19 @@ private:
srs_error_t package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, std::vector<SrsRtpPacket2*>& pkts);
srs_error_t consume_packets(std::vector<SrsRtpPacket2*>& pkts);
};
#endif
class SrsRtcDummyBridger : public ISrsSourceBridger
{
public:
SrsRtcDummyBridger();
virtual ~SrsRtcDummyBridger();
public:
virtual srs_error_t on_publish();
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio);
virtual srs_error_t on_video(SrsSharedPtrMessage* video);
virtual void on_unpublish();
};
#endif

View file

@ -352,6 +352,7 @@
#define ERROR_RTC_DISABLED 5021
#define ERROR_RTC_NO_SESSION 5022
#define ERROR_RTC_INVALID_PARAMS 5023
#define ERROR_RTC_DUMMY_BRIDGER 5024
///////////////////////////////////////////////////////
// GB28181 API error.