RTC: Cleanup code, remove RTC from SrsSource

pull/1804/head
winlin 5 years ago
parent 25496b734b
commit d434dc951d

@ -159,6 +159,7 @@ SrsRtcSource::SrsRtcSource()
rtc = new SrsRtc();
_can_publish = true;
rtc_publisher_ = NULL;
}
SrsRtcSource::~SrsRtcSource()

@ -50,10 +50,6 @@ using namespace std;
#include <srs_app_ng_exec.hpp>
#include <srs_app_dash.hpp>
#include <srs_protocol_format.hpp>
#ifdef SRS_RTC
#include <srs_app_rtc.hpp>
#include <srs_app_rtc_conn.hpp>
#endif
#define CONST_MAX_JITTER_MS 250
#define CONST_MAX_JITTER_MS_NEG -250
@ -867,9 +863,6 @@ SrsOriginHub::SrsOriginHub()
dash = new SrsDash();
dvr = new SrsDvr();
encoder = new SrsEncoder();
#ifdef SRS_RTC
rtc = new SrsRtc();
#endif
#ifdef SRS_HDS
hds = new SrsHds();
#endif
@ -913,12 +906,6 @@ srs_error_t SrsOriginHub::initialize(SrsSource* s, SrsRequest* r)
if ((err = format->initialize()) != srs_success) {
return srs_error_wrap(err, "format initialize");
}
#ifdef SRS_RTC
if ((err = rtc->initialize(req)) != srs_success) {
return srs_error_wrap(err, "rtc initialize");
}
#endif
if ((err = hls->initialize(this, req)) != srs_success) {
return srs_error_wrap(err, "hls initialize");
@ -1018,15 +1005,6 @@ srs_error_t SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
flv_sample_sizes[c->sound_size], flv_sound_types[c->sound_type],
srs_flv_srates[c->sound_rate]);
}
#ifdef SRS_RTC
// TODO: FIXME: Support parsing OPUS for RTC.
if ((err = rtc->on_audio(msg, format)) != srs_success) {
srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str());
srs_error_reset(err);
rtc->on_unpublish();
}
#endif
if ((err = hls->on_audio(msg, format)) != srs_success) {
// apply the error strategy for hls.
@ -1120,16 +1098,6 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
if (format->vcodec && !format->vcodec->is_avc_codec_ok()) {
return err;
}
#ifdef SRS_RTC
// Parse RTMP message to RTP packets, in FU-A if too large.
if ((err = rtc->on_video(msg, format)) != srs_success) {
// TODO: We should support more strategies.
srs_warn("rtc: ignore video error %s", srs_error_desc(err).c_str());
srs_error_reset(err);
rtc->on_unpublish();
}
#endif
if ((err = hls->on_video(msg, format)) != srs_success) {
// TODO: We should support more strategies.
@ -1199,12 +1167,6 @@ srs_error_t SrsOriginHub::on_publish()
return srs_error_wrap(err, "encoder publish");
}
#ifdef SRS_RTC
if ((err = rtc->on_publish()) != srs_success) {
return srs_error_wrap(err, "rtc publish");
}
#endif
if ((err = hls->on_publish()) != srs_success) {
return srs_error_wrap(err, "hls publish");
}
@ -1242,9 +1204,6 @@ void SrsOriginHub::on_unpublish()
destroy_forwarders();
encoder->on_unpublish();
#ifdef SRS_RTC
rtc->on_unpublish();
#endif
hls->on_unpublish();
dash->on_unpublish();
dvr->on_unpublish();
@ -1922,10 +1881,6 @@ SrsSource::SrsSource()
_srs_config->subscribe(this);
atc = false;
#ifdef SRS_RTC
rtc_publisher_ = NULL;
#endif
}
SrsSource::~SrsSource()
@ -2703,26 +2658,3 @@ string SrsSource::get_curr_origin()
return play_edge->get_curr_origin();
}
#ifdef SRS_RTC
SrsMetaCache* SrsSource::cached_meta()
{
return meta;
}
SrsRtcPublisher* SrsSource::rtc_publisher()
{
return rtc_publisher_;
}
void SrsSource::set_rtc_publisher(SrsRtcPublisher* v)
{
rtc_publisher_ = v;
}
srs_error_t SrsSource::on_rtc_audio(SrsSharedPtrMessage* audio)
{
// TODO: FIXME: Merge with on_audio.
// TODO: FIXME: Print key information.
return on_audio_imp(audio);
}
#endif

@ -62,9 +62,6 @@ class SrsBuffer;
#ifdef SRS_HDS
class SrsHds;
#endif
#ifdef SRS_RTC
class SrsRtcPublisher;
#endif
// The time jitter algorithm:
// 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
@ -358,10 +355,6 @@ private:
private:
// The format, codec information.
SrsRtmpFormat* format;
#ifdef SRS_RTC
// rtc handler
SrsRtc* rtc;
#endif
// hls handler.
SrsHls* hls;
// The DASH encoder.
@ -560,10 +553,6 @@ private:
// The last die time, when all consumers quit and no publisher,
// We will remove the source when source die.
srs_utime_t die_at;
#ifdef SRS_RTC
private:
SrsRtcPublisher* rtc_publisher_;
#endif
public:
SrsSource();
virtual ~SrsSource();
@ -630,17 +619,6 @@ public:
virtual void on_edge_proxy_unpublish();
public:
virtual std::string get_curr_origin();
#ifdef SRS_RTC
public:
// For RTC, we need to package SPS/PPS(in cached meta) before each IDR.
SrsMetaCache* cached_meta();
// Get and set the publisher, passed to consumer to process requests such as PLI.
SrsRtcPublisher* rtc_publisher();
void set_rtc_publisher(SrsRtcPublisher* v);
// When got RTC audio message, which is encoded in opus.
// TODO: FIXME: Merge with on_audio.
srs_error_t on_rtc_audio(SrsSharedPtrMessage* audio);
#endif
};
#endif

Loading…
Cancel
Save