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

SquashSRS4: Remove srs-librtmp

This commit is contained in:
winlin 2021-05-20 20:07:13 +08:00
parent f043a7eb48
commit 6dc8d9dd6f
26 changed files with 139 additions and 189 deletions

View file

@ -23,8 +23,6 @@
#include <srs_app_gb28181_stack.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
@ -1457,5 +1455,3 @@ void SrsSipStack::req_ptz(std::stringstream& ss, SrsSipRequest *req, uint8_t cmd
}
#endif

View file

@ -26,8 +26,6 @@
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
#include <sstream>
#include <vector>
@ -185,5 +183,3 @@ public:
#endif
#endif

View file

@ -33,6 +33,8 @@ using namespace std;
#include <srs_protocol_kbps.hpp>
SrsPps* _srs_pps_timer = NULL;
SrsPps* _srs_pps_conn = NULL;
SrsPps* _srs_pps_pub = NULL;
extern SrsPps* _srs_pps_clock_15ms;
extern SrsPps* _srs_pps_clock_20ms;

View file

@ -374,6 +374,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval)
#endif
string objs_desc;
#ifdef SRS_RTC
_srs_pps_objs_rtps->update(); _srs_pps_objs_rraw->update(); _srs_pps_objs_rfua->update(); _srs_pps_objs_rbuf->update(); _srs_pps_objs_msgs->update(); _srs_pps_objs_rothers->update();
if (_srs_pps_objs_rtps->r10s() || _srs_pps_objs_rraw->r10s() || _srs_pps_objs_rfua->r10s() || _srs_pps_objs_rbuf->r10s() || _srs_pps_objs_msgs->r10s() || _srs_pps_objs_rothers->r10s()) {
snprintf(buf, sizeof(buf), ", objs=(pkt:%d,raw:%d,fua:%d,msg:%d,oth:%d,buf:%d)",
@ -381,6 +382,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval)
_srs_pps_objs_msgs->r10s(), _srs_pps_objs_rothers->r10s(), _srs_pps_objs_rbuf->r10s());
objs_desc = buf;
}
#endif
srs_trace("Hybrid cpu=%.2f%%,%dMB%s%s%s%s%s%s%s%s%s%s%s",
u->percent * 100, memory,

View file

@ -68,8 +68,6 @@ SrsPps* _srs_pps_srtps = NULL;
SrsPps* _srs_pps_pli = NULL;
SrsPps* _srs_pps_twcc = NULL;
SrsPps* _srs_pps_rr = NULL;
SrsPps* _srs_pps_pub = NULL;
SrsPps* _srs_pps_conn = NULL;
extern SrsPps* _srs_pps_snack;
extern SrsPps* _srs_pps_snack2;
@ -79,6 +77,9 @@ extern SrsPps* _srs_pps_snack4;
extern SrsPps* _srs_pps_rnack;
extern SrsPps* _srs_pps_rnack2;
extern SrsPps* _srs_pps_pub;
extern SrsPps* _srs_pps_conn;
ISrsRtcTransport::ISrsRtcTransport()
{
}

View file

@ -961,12 +961,14 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source)
SrsRequest* req = info->req;
// @see https://github.com/ossrs/srs/issues/2364
// @see https://github.com/ossrs/srs/issues/2364
// Check whether GB28181 stream is busy.
#if defined(SRS_GB28181)
SrsGb28181RtmpMuxer* gb28181 = _srs_gb28181->fetch_rtmpmuxer(req->stream);
if (gb28181 != NULL) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 stream %s busy", req->get_stream_url().c_str());
if (_srs_gb28181 != NULL) {
SrsGb28181RtmpMuxer* gb28181 = _srs_gb28181->fetch_rtmpmuxer(req->stream);
if (gb28181 != NULL) {
return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 stream %s busy", req->get_stream_url().c_str());
}
}
#endif

View file

@ -31,9 +31,12 @@
#include <srs_app_source.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_app_rtc_server.hpp>
#include <srs_app_log.hpp>
#ifdef SRS_RTC
#include <srs_app_rtc_dtls.hpp>
#include <srs_app_rtc_conn.hpp>
#include <srs_app_log.hpp>
#endif
#include <string>
using namespace std;
@ -43,11 +46,14 @@ extern ISrsContext* _srs_context;
extern SrsConfig* _srs_config;
extern SrsStageManager* _srs_stages;
#ifdef SRS_RTC
extern SrsRtcBlackhole* _srs_blackhole;
extern SrsResourceManager* _srs_rtc_manager;
extern SrsResourceManager* _srs_rtc_manager;
extern SrsDtlsCertificate* _srs_rtc_dtls_certificate;
#endif
#include <srs_protocol_kbps.hpp>
@ -254,12 +260,24 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval)
// The hybrid thread cpu and memory.
float thread_percent = stat->percent * 100;
if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level() || _srs_pps_snack2->r10s())) {
srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%, snk=%d,%d,%d",
static char buf[128];
string snk_desc;
#ifdef SRS_RTC
if (_srs_pps_snack2->r10s()) {
snprintf(buf, sizeof(buf), ", snk=%d,%d,%d",
_srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent.
);
snk_desc = buf;
}
#endif
if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level())) {
srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%%s",
u->percent * 100, memory,
hybrid_high_water_level(), hybrid_critical_water_level(), hybrid_dying_water_level(), // Whether Circuit-Break is enable.
thread_percent, // The conditions to enable Circuit-Breaker.
_srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent.
snk_desc.c_str()
);
}
@ -291,15 +309,17 @@ srs_error_t srs_thread_initialize()
// The global objects which depends on ST.
_srs_hybrid = new SrsHybridServer();
_srs_rtc_sources = new SrsRtcSourceManager();
_srs_sources = new SrsLiveSourceManager();
_srs_stages = new SrsStageManager();
_srs_blackhole = new SrsRtcBlackhole();
_srs_rtc_manager = new SrsResourceManager("RTC", true);
_srs_circuit_breaker = new SrsCircuitBreaker();
#ifdef SRS_RTC
_srs_rtc_sources = new SrsRtcSourceManager();
_srs_blackhole = new SrsRtcBlackhole();
_srs_rtc_manager = new SrsResourceManager("RTC", true);
_srs_rtc_dtls_certificate = new SrsDtlsCertificate();
#endif
// Initialize global pps, which depends on _srs_clock
_srs_pps_ids = new SrsPps();
@ -308,7 +328,10 @@ srs_error_t srs_thread_initialize()
_srs_pps_dispose = new SrsPps();
_srs_pps_timer = new SrsPps();
_srs_pps_conn = new SrsPps();
_srs_pps_pub = new SrsPps();
#ifdef SRS_RTC
_srs_pps_snack = new SrsPps();
_srs_pps_snack2 = new SrsPps();
_srs_pps_snack3 = new SrsPps();
@ -320,6 +343,7 @@ srs_error_t srs_thread_initialize()
_srs_pps_rnack2 = new SrsPps();
_srs_pps_rhnack = new SrsPps();
_srs_pps_rmnack = new SrsPps();
#endif
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
_srs_pps_recvfrom = new SrsPps();
@ -377,30 +401,29 @@ srs_error_t srs_thread_initialize()
_srs_pps_fast_addrs = new SrsPps();
_srs_pps_spkts = new SrsPps();
_srs_pps_objs_msgs = new SrsPps();
#ifdef SRS_RTC
_srs_pps_sstuns = new SrsPps();
_srs_pps_srtcps = new SrsPps();
_srs_pps_srtps = new SrsPps();
_srs_pps_pli = new SrsPps();
_srs_pps_twcc = new SrsPps();
_srs_pps_rr = new SrsPps();
_srs_pps_pub = new SrsPps();
_srs_pps_conn = new SrsPps();
_srs_pps_rstuns = new SrsPps();
_srs_pps_rrtps = new SrsPps();
_srs_pps_rrtcps = new SrsPps();
_srs_pps_aloss2 = new SrsPps();
_srs_pps_objs_msgs = new SrsPps();
_srs_pps_pli = new SrsPps();
_srs_pps_twcc = new SrsPps();
_srs_pps_rr = new SrsPps();
_srs_pps_objs_rtps = new SrsPps();
_srs_pps_objs_rraw = new SrsPps();
_srs_pps_objs_rfua = new SrsPps();
_srs_pps_objs_rbuf = new SrsPps();
_srs_pps_objs_rothers = new SrsPps();
#endif
return err;
}

View file

@ -98,13 +98,10 @@
} \
(void)0
// For librtmp, it is pure c++ and supports all OS.
#ifndef SRS_EXPORT_LIBRTMP
// Checking for st(state-threads), only support the following cpus: i386/amd64/x86_64/arm
// @reamrk To patch ST for arm, read https://github.com/ossrs/state-threads/issues/1
#if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__) && !defined(__aarch64__)
#error "only support i386/amd64/x86_64/arm cpu"
#endif
// Checking for st(state-threads), only support the following cpus: i386/amd64/x86_64/arm
// @reamrk To patch ST for arm, read https://github.com/ossrs/state-threads/issues/1
#if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__) && !defined(__aarch64__)
#error "only support i386/amd64/x86_64/arm cpu"
#endif
// Error predefined for all modules.

View file

@ -26,6 +26,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 117
#define VERSION_REVISION 118
#endif

View file

@ -23,8 +23,6 @@
#include <srs_kernel_aac.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <unistd.h>
@ -202,5 +200,3 @@ srs_error_t SrsAacTransmuxer::write_audio(int64_t timestamp, char* data, int siz
return err;
}
#endif

View file

@ -26,8 +26,6 @@
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
#include <srs_kernel_codec.hpp>
@ -61,5 +59,3 @@ public:
#endif
#endif

View file

@ -23,8 +23,6 @@
#include <srs_kernel_mp3.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <unistd.h>
@ -126,5 +124,3 @@ srs_error_t SrsMp3Transmuxer::write_audio(int64_t timestamp, char* data, int siz
return err;
}
#endif

View file

@ -26,8 +26,6 @@
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
class SrsBuffer;
@ -65,5 +63,3 @@ public:
#endif
#endif

View file

@ -823,9 +823,8 @@ char* SrsRtpPacket::wrap(char* data, int size)
char* SrsRtpPacket::wrap(SrsSharedPtrMessage* msg)
{
// Generally, the wrap(msg) is used for RTMP to RTC, which is not generated by RTC,
// so we do not recycle the msg. It's ok to directly free the msg, event the msg is
// allocated by object cache manager.
// Generally, the wrap(msg) is used for RTMP to RTC, where the msg
// is not generated by RTC.
srs_freep(shared_buffer_);
// Copy from the new message.
@ -840,11 +839,6 @@ SrsRtpPacket* SrsRtpPacket::copy()
{
SrsRtpPacket* cp = new SrsRtpPacket();
// We got packet from cache, the payload and message MUST be NULL,
// because we had clear it in recycle.
//srs_assert(!cp->payload_);
//srs_assert(!cp->shared_buffer_);
cp->header = header;
cp->payload_ = payload_? payload_->copy():NULL;
cp->payload_type_ = payload_type_;

View file

@ -23,8 +23,6 @@
#include <srs_kernel_ts.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
// for srs-librtmp, @see https://github.com/ossrs/srs/issues/213
#ifndef _WIN32
#include <unistd.h>
@ -3174,5 +3172,3 @@ srs_error_t SrsTsTransmuxer::flush_video()
return err;
}
#endif

View file

@ -26,8 +26,6 @@
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
#include <map>
#include <vector>
@ -1350,5 +1348,3 @@ private:
#endif
#endif

View file

@ -23,8 +23,6 @@
#include <srs_http_stack.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <stdlib.h>
#include <sstream>
#include <algorithm>
@ -1346,9 +1344,6 @@ srs_error_t SrsHttpUri::path_unescape(std::string s, std::string& value)
return unescapse(s, value, encodePathSegment);
}
// For #if !defined(SRS_EXPORT_LIBRTMP)
#endif
// LCOV_EXCL_START
/////////////////////////////////////////////////////////////////////////////////////////

View file

@ -28,8 +28,6 @@
#include <srs_kernel_io.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <map>
#include <string>
#include <vector>
@ -549,9 +547,6 @@ public:
static srs_error_t path_unescape(std::string s, std::string& value);
};
// For #if !defined(SRS_EXPORT_LIBRTMP)
#endif
// For #ifndef SRS_PROTOCOL_HTTP_HPP
#endif

View file

@ -23,8 +23,6 @@
#include <srs_rtsp_stack.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <stdlib.h>
#include <map>
using namespace std;
@ -1100,5 +1098,3 @@ srs_error_t SrsRtspStack::recv_token(std::string& token, SrsRtspTokenState& stat
return err;
}
#endif

View file

@ -26,8 +26,6 @@
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
#include <sstream>
@ -578,5 +576,3 @@ private:
#endif
#endif