1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 19:31:53 +00:00

For #1500, support push stream by GB28181. 4.0.18

This commit is contained in:
winlin 2020-03-31 23:06:07 +08:00
parent d81cde695d
commit 608f3d0fae
11 changed files with 59 additions and 12 deletions

View file

@ -6,15 +6,17 @@ jobs:
steps:
- checkout
- run: |
cd trunk && ./configure --without-rtc --without-utest && make &&
./configure --with-rtc --with-utest && make clean && make
cd trunk &&
./configure --without-rtc --without-gb28181 --without-utest && make &&
./configure --with-rtc --with-gb28181 --with-utest && make clean && make
test:
docker:
- image: ossrs/srs:dev
steps:
- checkout
- run: |
cd trunk && ./configure --with-utest --gcov && make &&
cd trunk &&
./configure --with-rtc --with-gb28181 --with-utest --gcov && make &&
./objs/srs_utest && bash auto/coverage.sh
workflows:
version: 2

View file

@ -136,6 +136,7 @@ For previous versions, please read:
- [x] [Experimental] Support HTTP RAW API, please read [#459][bug #459], [#470][bug #470], [#319][bug #319].
- [x] [Experimental] Support SRT server, read [#1147][bug #1147].
- [x] [Experimental] Support playing stream by WebRTC, [#307][bug #307].
- [x] [Experimental] Support push stream by GB28181, [#1500][bug #1500].
- [x] [Deprecated] Support Adobe HDS(f4m), please read wiki([CN][v2_CN_DeliveryHDS], [EN][v2_EN_DeliveryHDS]) and [#1535][bug #1535].
- [x] [Deprecated] Support bandwidth testing([CN][v1_CN_BandwidthTestTool], [EN][v1_EN_BandwidthTestTool]), please read [#1535][bug #1535].
- [x] [Deprecated] Support Adobe FMS/AMS token traverse([CN][v3_CN_DRM2], [EN][v3_EN_DRM2]) authentication, please read [#1535][bug #1535].
@ -157,6 +158,7 @@ For previous versions, please read:
## V4 changes
* v4.0, 2020-03-31, For [#1500][bug #1500], support push stream by GB28181. 4.0.18
* v4.0, 2020-03-31, Play stream by WebRTC on iOS/Android/PC browser. 4.0.17
* v4.0, 2020-03-28, Support multiple OS/Platform build cache. 4.0.16
* v4.0, 2020-03-28, For [#1250][bug #1250], support macOS, OSX, MacbookPro, Apple Darwin.
@ -1154,6 +1156,7 @@ Maintainers of SRS project:
* [Runner365](https://github.com/runner365): The focus of his work is on the [SRT](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_SRTWiki) module.
* [John](https://github.com/xiaozhihong): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_RTCWiki) module.
* [B.P.Y(Bepartofyou)](https://github.com/Bepartofyou): Focus on [WebRTC](https://github.com/simple-rtmp-server/srs/wiki/v4_CN_RTCWiki) module.
* [Lixin](https://github.com/xialixin): Focus on [GB28181](https://github.com/ossrs/srs/issues/1500) module.
A big THANK YOU goes to:

View file

@ -79,6 +79,12 @@ else
srs_undefine_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GB28181 = YES ]; then
srs_define_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_GB28181" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else

View file

@ -18,6 +18,7 @@ help=no
SRS_HDS=NO
SRS_SRT=NO
SRS_RTC=YES
SRS_GB28181=NO
SRS_NASM=YES
SRS_NGINX=NO
SRS_FFMPEG_TOOL=NO
@ -136,16 +137,18 @@ Features:
--with-utest Build the utest for SRS.
--with-srt Build the SRT support for SRS.
--with-rtc Build the WebRTC support for SRS.
--with-gb28181 Build the GB28181 support for SRS.
--without-ssl Disable rtmp complex handshake.
--without-hds Disable hds, the adobe http dynamic streaming.
--without-stream-caster Disable stream caster, only listen and serve RTMP/HTTP.
--without-stat Disable the data statistic feature.
--without-librtmp Disable srs-librtmp, library for client.
--without-research Do not build the research tools.
--without-utest Do not build the utest for SRS.
--without-srt Do not build the SRT support for SRS.
--without-rtc Do not build the WebRTC support for SRS.
--without-research Disable the research tools.
--without-utest Disable the utest for SRS.
--without-srt Disable the SRT support for SRS.
--without-rtc Disable the WebRTC support for SRS.
--without-gb28181 Disable the GB28181 support for SRS.
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
--static Whether add '-static' to link options.
@ -231,6 +234,7 @@ function parse_user_option() {
--with-utest) SRS_UTEST=YES ;;
--with-srt) SRS_SRT=YES ;;
--with-rtc) SRS_RTC=YES ;;
--with-gb28181) SRS_GB28181=YES ;;
--with-nasm) SRS_NASM=YES ;;
--with-gperf) SRS_GPERF=YES ;;
--with-gmc) SRS_GPERF_MC=YES ;;
@ -249,6 +253,7 @@ function parse_user_option() {
--without-utest) SRS_UTEST=NO ;;
--without-srt) SRS_SRT=NO ;;
--without-rtc) SRS_RTC=NO ;;
--without-gb28181) SRS_GB28181=NO ;;
--without-nasm) SRS_NASM=NO ;;
--without-gperf) SRS_GPERF=NO ;;
--without-gmc) SRS_GPERF_MC=NO ;;
@ -550,6 +555,7 @@ function regenerate_options() {
if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
if [ $SRS_SRT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-srt"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-srt"; fi
if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-rtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-rtc"; fi
if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gb28181"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gb28181"; fi
if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nasm"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nasm"; fi
if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi

5
trunk/configure vendored
View file

@ -277,10 +277,13 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
"srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers" "srs_app_hybrid" "srs_app_gb28181" "srs_app_gb28181_sip")
"srs_app_coworkers" "srs_app_hybrid")
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc" "srs_app_rtc_conn" "srs_app_dtls" "srs_app_audio_recode" "srs_app_sdp")
fi
if [[ $SRS_GB28181 == YES ]]; then
MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip")
fi
DEFINES=""
# add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do

View file

@ -1578,6 +1578,8 @@ srs_error_t SrsGoApiError::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage
return srs_api_response_code(w, r, 100);
}
#ifdef SRS_AUTO_GB28181
SrsGoApiGb28181::SrsGoApiGb28181()
{
}
@ -1703,8 +1705,10 @@ srs_error_t SrsGoApiGb28181::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
}
}
#endif
SrsHttpApi::SrsHttpApi(IConnectionManager* cm, srs_netfd_t fd, SrsHttpServeMux* m, string cip)
: SrsConnection(cm, fd, cip)
: SrsConnection(cm, fd, cip)
{
mux = m;
cors = new SrsHttpCorsMux();

View file

@ -233,6 +233,8 @@ public:
};
#ifdef SRS_AUTO_GB28181
class SrsGoApiGb28181 : public ISrsHttpHandler
{
public:
@ -242,6 +244,8 @@ public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
};
#endif
class SrsHttpApi : virtual public SrsConnection, virtual public ISrsReloadHandler
{
private:

View file

@ -349,6 +349,7 @@ SrsUdpCasterListener::~SrsUdpCasterListener()
srs_freep(caster);
}
#ifdef SRS_AUTO_GB28181
SrsGb28181Listener::SrsGb28181Listener(SrsServer* svr, SrsListenerType t, SrsConfDirective* c) : SrsUdpStreamListener(svr, t, NULL)
{
@ -369,6 +370,8 @@ SrsGb28181Listener::~SrsGb28181Listener()
srs_freep(caster);
}
#endif
SrsSignalManager* SrsSignalManager::instance = NULL;
SrsSignalManager::SrsSignalManager(SrsServer* s)
@ -692,8 +695,10 @@ void SrsServer::destroy()
srs_freep(signal_manager);
srs_freep(conn_manager);
#ifdef SRS_AUTO_GB28181
//free global gb28281 manager
srs_freep(_srs_gb28181);
#endif
}
void SrsServer::dispose()
@ -984,10 +989,11 @@ srs_error_t SrsServer::http_handle()
if ((err = http_api_mux->handle("/api/v1/clusters", new SrsGoApiClusters())) != srs_success) {
return srs_error_wrap(err, "handle raw");
}
#ifdef SRS_AUTO_GB28181
if ((err = http_api_mux->handle("/api/v1/gb28181", new SrsGoApiGb28181())) != srs_success) {
return srs_error_wrap(err, "handle raw");
}
#endif
// test the request info.
if ((err = http_api_mux->handle("/api/v1/tests/requests", new SrsGoApiRequests())) != srs_success) {
@ -1342,6 +1348,7 @@ srs_error_t SrsServer::listen_http_stream()
return err;
}
#ifdef SRS_AUTO_GB28181
srs_error_t SrsServer::listen_gb28281_sip(SrsConfDirective* stream_caster)
{
srs_error_t err = srs_success;
@ -1365,6 +1372,7 @@ srs_error_t SrsServer::listen_gb28281_sip(SrsConfDirective* stream_caster)
return err;
}
#endif
srs_error_t SrsServer::listen_stream_caster()
{
@ -1391,6 +1399,7 @@ srs_error_t SrsServer::listen_stream_caster()
} else if (srs_stream_caster_is_flv(caster)) {
listener = new SrsHttpFlvListener(this, SrsListenerFlv, stream_caster);
} else if (srs_stream_caster_is_gb28181(caster)) {
#ifdef SRS_AUTO_GB28181
//init global gb28281 manger
if (_srs_gb28181 == NULL){
_srs_gb28181 = new SrsGb28181Manger(stream_caster);
@ -1408,6 +1417,10 @@ srs_error_t SrsServer::listen_stream_caster()
//gb28281 stream listener
listener = new SrsGb28181Listener(this, SrsListenerGb28181RtpMux, stream_caster);
#else
srs_warn("gb28181 is disabled, please enable it by: ./configure --with-gb28181");
continue;
#endif
} else {
return srs_error_new(ERROR_STREAM_CASTER_ENGINE, "invalid caster %s", caster.c_str());
}

View file

@ -164,6 +164,8 @@ public:
virtual ~SrsUdpCasterListener();
};
#ifdef SRS_AUTO_GB28181
// A UDP gb28181 listener, for sip and rtp stream mux server.
class SrsGb28181Listener : public SrsUdpStreamListener
{
@ -172,6 +174,8 @@ public:
virtual ~SrsGb28181Listener();
};
#endif
// Convert signal to io,
// @see: st-1.9/docs/notes.html
class SrsSignalManager : public ISrsCoroutineHandler
@ -319,7 +323,9 @@ private:
virtual srs_error_t listen_http_api();
virtual srs_error_t listen_http_stream();
virtual srs_error_t listen_stream_caster();
#ifdef SRS_AUTO_GB28181
virtual srs_error_t listen_gb28281_sip(SrsConfDirective* c);
#endif
// Close the listeners for specified type,
// Remove the listen object from manager.
virtual void close_listeners(SrsListenerType type);

View file

@ -43,7 +43,7 @@
#define RTMP_SIG_SRS_CODE "Leo"
#define RTMP_SIG_SRS_URL "https://github.com/ossrs/srs"
#define RTMP_SIG_SRS_LICENSE "MIT"
#define RTMP_SIG_SRS_AUTHORS "Winlin,Wenjie,Runner365,John,B.P.Y"
#define RTMP_SIG_SRS_AUTHORS "Winlin,Wenjie,Runner365,John,B.P.Y,Lixin"
#define RTMP_SIG_SRS_VERSION SRS_XSTR(VERSION_MAJOR) "." SRS_XSTR(VERSION_MINOR) "." SRS_XSTR(VERSION_REVISION)
#define RTMP_SIG_SRS_SERVER RTMP_SIG_SRS_KEY "/" RTMP_SIG_SRS_VERSION "(" RTMP_SIG_SRS_CODE ")"

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION4_HPP
#define SRS_CORE_VERSION4_HPP
#define SRS_VERSION4_REVISION 17
#define SRS_VERSION4_REVISION 18
#endif