Skip to content

Commit

Permalink
For #1500, support push stream by GB28181. 4.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 31, 2020
1 parent d81cde6 commit 608f3d0
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 12 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -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.
Expand Down Expand Up @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions trunk/auto/auto_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions trunk/auto/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 ;;
Expand All @@ -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 ;;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion trunk/src/app/srs_app_http_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
}
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions trunk/src/app/srs_app_http_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ class SrsGoApiError : public ISrsHttpHandler
};


#ifdef SRS_AUTO_GB28181

class SrsGoApiGb28181 : public ISrsHttpHandler
{
public:
Expand All @@ -242,6 +244,8 @@ class SrsGoApiGb28181 : public ISrsHttpHandler
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
};

#endif

class SrsHttpApi : virtual public SrsConnection, virtual public ISrsReloadHandler
{
private:
Expand Down
15 changes: 14 additions & 1 deletion trunk/src/app/srs_app_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -369,6 +370,8 @@ SrsGb28181Listener::~SrsGb28181Listener()
srs_freep(caster);
}

#endif

SrsSignalManager* SrsSignalManager::instance = NULL;

SrsSignalManager::SrsSignalManager(SrsServer* s)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -1365,6 +1372,7 @@ srs_error_t SrsServer::listen_gb28281_sip(SrsConfDirective* stream_caster)

return err;
}
#endif

srs_error_t SrsServer::listen_stream_caster()
{
Expand All @@ -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);
Expand All @@ -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());
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/src/app/srs_app_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class SrsUdpCasterListener : public SrsUdpStreamListener
virtual ~SrsUdpCasterListener();
};

#ifdef SRS_AUTO_GB28181

// A UDP gb28181 listener, for sip and rtp stream mux server.
class SrsGb28181Listener : public SrsUdpStreamListener
{
Expand All @@ -172,6 +174,8 @@ class SrsGb28181Listener : public SrsUdpStreamListener
virtual ~SrsGb28181Listener();
};

#endif

// Convert signal to io,
// @see: st-1.9/docs/notes.html
class SrsSignalManager : public ISrsCoroutineHandler
Expand Down Expand Up @@ -319,7 +323,9 @@ class SrsServer : virtual public ISrsReloadHandler, virtual public ISrsSourceHan
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);
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")"

Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 608f3d0

Please sign in to comment.