mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
GB28181: Support GB28181-2016 protocol. v5.0.74 (#3201)
01. Support GB config as StreamCaster. 02. Support disable GB by --gb28181=off. 03. Add utests for SIP examples. 04. Wireshark plugin to decode TCP/9000 as rtp.rfc4571 05. Support MPEGPS program stream codec. 06. Add utest for PS stream codec. 07. Decode MPEGPS packet stream. 08. Carry RTP and PS packet as helper in PS message. 09. Support recover from error mode. 10. Support process by a pack of PS/TS messages. 11. Add statistic for recovered and msgs dropped. 12. Recover from err position fastly. 13. Define state machine for GB session. 14. Bind context to GB session. 15. Re-invite when media disconnected. 16. Update GitHub actions with GB28181. 17. Support parse CANDIDATE by env or pip. 18. Support mux GB28181 to RTMP. 19. Support regression test by srs-bench.
This commit is contained in:
parent
9c81a0e1bd
commit
5a420ece3b
298 changed files with 43343 additions and 763 deletions
|
@ -40,6 +40,9 @@ using namespace std;
|
|||
#ifdef SRS_RTC
|
||||
#include <srs_app_rtc_network.hpp>
|
||||
#endif
|
||||
#ifdef SRS_GB28181
|
||||
#include <srs_app_gb28181.hpp>
|
||||
#endif
|
||||
|
||||
SrsSignalManager* SrsSignalManager::instance = NULL;
|
||||
|
||||
|
@ -336,7 +339,10 @@ SrsServer::SrsServer()
|
|||
stream_caster_flv_listener_ = new SrsHttpFlvListener();
|
||||
stream_caster_mpegts_ = new SrsUdpCasterListener();
|
||||
exporter_listener_ = new SrsTcpListener(this);
|
||||
|
||||
#ifdef SRS_GB28181
|
||||
stream_caster_gb28181_ = new SrsGbListener();
|
||||
#endif
|
||||
|
||||
// donot new object in constructor,
|
||||
// for some global instance is not ready now,
|
||||
// new these objects in initialize instead.
|
||||
|
@ -392,6 +398,9 @@ void SrsServer::destroy()
|
|||
srs_freep(stream_caster_flv_listener_);
|
||||
srs_freep(stream_caster_mpegts_);
|
||||
srs_freep(exporter_listener_);
|
||||
#ifdef SRS_GB28181
|
||||
srs_freep(stream_caster_gb28181_);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SrsServer::dispose()
|
||||
|
@ -408,6 +417,9 @@ void SrsServer::dispose()
|
|||
stream_caster_flv_listener_->close();
|
||||
stream_caster_mpegts_->close();
|
||||
exporter_listener_->close();
|
||||
#ifdef SRS_GB28181
|
||||
stream_caster_gb28181_->close();
|
||||
#endif
|
||||
|
||||
// Fast stop to notify FFMPEG to quit, wait for a while then fast kill.
|
||||
ingester->dispose();
|
||||
|
@ -436,6 +448,9 @@ void SrsServer::gracefully_dispose()
|
|||
stream_caster_flv_listener_->close();
|
||||
stream_caster_mpegts_->close();
|
||||
exporter_listener_->close();
|
||||
#ifdef SRS_GB28181
|
||||
stream_caster_gb28181_->close();
|
||||
#endif
|
||||
srs_trace("listeners closed");
|
||||
|
||||
// Fast stop to notify FFMPEG to quit, wait for a while then fast kill.
|
||||
|
@ -632,6 +647,15 @@ srs_error_t SrsServer::listen()
|
|||
if ((err = stream_caster_flv_listener_->initialize(conf)) != srs_success) {
|
||||
return srs_error_wrap(err, "initialize");
|
||||
}
|
||||
} else if (srs_stream_caster_is_gb28181(caster)) {
|
||||
#ifdef SRS_GB28181
|
||||
listener = stream_caster_gb28181_;
|
||||
if ((err = stream_caster_gb28181_->initialize(conf)) != srs_success) {
|
||||
return srs_error_wrap(err, "initialize");
|
||||
}
|
||||
#else
|
||||
return srs_error_new(ERROR_STREAM_CASTER_ENGINE, "Please enable GB by: ./configure --gb28181=on");
|
||||
#endif
|
||||
} else {
|
||||
return srs_error_new(ERROR_STREAM_CASTER_ENGINE, "invalid caster %s", caster.c_str());
|
||||
}
|
||||
|
@ -1318,6 +1342,17 @@ srs_error_t SrsServerAdapter::run(SrsWaitGroup* wg)
|
|||
return srs_error_wrap(err, "start");
|
||||
}
|
||||
|
||||
#ifdef SRS_GB28181
|
||||
if ((err = _srs_gb_manager->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "start manager");
|
||||
}
|
||||
#endif
|
||||
|
||||
SrsSweepGc* gc = dynamic_cast<SrsSweepGc*>(_srs_gc);
|
||||
if ((err = gc->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "start gc");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue