diff --git a/README.md b/README.md index a37ee269a..a1dc1a8e2 100755 --- a/README.md +++ b/README.md @@ -153,10 +153,16 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-01-26, Allow use libsrt.so for SRT is MPL license. 4.0.2 * v4.0, 2020-01-24, Fix [#1147][bug #1147], support SRT(Secure Reliable Transport). 4.0.1 ## V3 changes +* v3.0, 2020-01-27, Fix [#1303][bug #1303], do not dispatch previous meta when not publishing. 3.0.109 +* v3.0, 2020-01-26, Allow use libst.so for ST is MPL license. +* v3.0, 2020-01-26, Fix [#607][bug #607], set RTMP identifying recursive depth to 3. +* v3.0, 2020-01-25, Fix [#878][bug #878], remove deprecated #EXT-X-ALLOW-CACHE for HLS. 3.0.108 +* v3.0, 2020-01-25, Fix [#703][bug #703], drop video data util sps/pps. 3.0.107 * v3.0, 2020-01-25, Fix [#1108][bug #1108], reap DVR tmp file when unpublish. 3.0.106 * v3.0, 2020-01-21, [3.0 alpha9(3.0.105)][r3.0a9] released. 121577 lines. * v3.0, 2020-01-21, Fix [#1221][bug #1221], remove complex configure options. 3.0.104 @@ -784,7 +790,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Stream Delivery** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | RTMP | Stable | Stable | Stable | Stable | Stable | | HLS | Stable | Stable | X | Stable | Stable | @@ -792,12 +798,13 @@ Comparing with other media servers, SRS is much better and stronger, for details | HLS(aonly) | Stable | X | X | Stable | Stable | | HDS | Experiment| X | X | Stable | Stable | | MPEG-DASH | Experiment| X | X | X | X | +| SRT | Experiment| X | X | X | Stable | | HTTP Server | Stable | Stable | X | X | Stable | **Cluster** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | RTMP Edge | Stable | X | X | Stable | X | | RTMP Backup | Stable | X | X | X | X | @@ -810,7 +817,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Stream Service** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | DVR | Stable | Stable | X | X | Stable | | DVR API | Stable | Stable | X | X | X | @@ -827,7 +834,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Efficiency** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | Concurrency | 7.5k | 3k | 2k | 2k | 3k | |MultipleProcess| Experiment| Stable | X | X | X | @@ -837,7 +844,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Stream Caster** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | Ingest | Stable | X | X | X | X | | Push MPEGTS | Experiment| X | X | X | Stable | @@ -847,7 +854,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Debug System** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | BW check | Stable | X | X | X | X | | Tracable Log | Stable | X | X | X | X | @@ -855,7 +862,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Docs** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | Demos | Stable | X | X | X | X | | WIKI(EN+CN) | Stable | EN only | X | X | Stable | @@ -863,7 +870,7 @@ Comparing with other media servers, SRS is much better and stronger, for details **Others** -| Feature | SRS | NGINX | CRTMPD | FMS | WOWZA | +| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA | | ----------- | ------- | ----- | --------- | -------- | ------ | | ARM/MIPS | Stable | Stable | X | X | X | | Client Library| Stable | X | X | X | X | @@ -1119,6 +1126,15 @@ Gitlab: [https://gitlab.com/winlinvip/srs-gitlab][gitlab], the GIT usage([CN][v1 git clone https://gitlab.com/winlinvip/srs-gitlab.git ``` +| Branch | Cost | Size | CMD | +| --- | --- | --- | --- | +| 3.0release | 2m19.931s | 262MB | git clone -b 3.0release https://gitee.com/winlinvip/srs.oschina.git | +| 3.0release | 0m56.515s | 95MB | git clone -b 3.0release --depth=1 https://gitee.com/winlinvip/srs.oschina.git | +| develop | 2m22.430s | 234MB | git clone -b develop https://gitee.com/winlinvip/srs.oschina.git | +| develop | 0m46.421s | 42MB | git clone -b develop --depth=1 https://gitee.com/winlinvip/srs.oschina.git | +| min | 2m22.865s | 217MB | git clone -b min https://gitee.com/winlinvip/srs.oschina.git | +| min | 0m36.472s | 11MB | git clone -b min --depth=1 https://gitee.com/winlinvip/srs.oschina.git | + ## System Requirements Supported operating systems and hardware: @@ -1631,6 +1647,10 @@ Winlin [bug #463]: https://github.com/ossrs/srs/issues/463 [bug #1147]: https://github.com/ossrs/srs/issues/1147 [bug #1108]: https://github.com/ossrs/srs/issues/1108 +[bug #703]: https://github.com/ossrs/srs/issues/703 +[bug #878]: https://github.com/ossrs/srs/issues/878 +[bug #607]: https://github.com/ossrs/srs/issues/607 +[bug #1303]: https://github.com/ossrs/srs/issues/1303 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 3105f7fdf..a4c8730df 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -329,7 +329,7 @@ fi # Affected users should upgrade to OpenSSL 1.1.0e. Users unable to immediately # upgrade can alternatively recompile OpenSSL with -DOPENSSL_NO_HEARTBEATS. if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then - OPENSSL_HOTFIX="-DOPENSSL_NO_HEARTBEATS" + OPENSSL_OPTIONS="-no-shared -no-threads -no-asm -DOPENSSL_NO_HEARTBEATS" OPENSSL_CONFIG="./config" # https://stackoverflow.com/questions/15539062/cross-compiling-of-openssl-for-linux-arm-v5te-linux-gnueabi-toolchain if [[ $SRS_CROSS_BUILD == YES ]]; then @@ -351,7 +351,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then ( rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} && unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e && - ${OPENSSL_CONFIG} --prefix=`pwd`/_release -no-shared -no-threads -no-asm $OPENSSL_HOTFIX && + ${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS && make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} && make install_sw && cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl ) diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 13ffe88b1..8c7cdae51 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -48,6 +48,10 @@ SRS_FFMPEG_STUB=NO SRS_PREFIX=/usr/local/srs SRS_JOBS=1 SRS_STATIC=NO +# If enabled, link shared libraries for libst.so which uses MPL license. +SRS_SHARED_ST=NO +# If enabled, link shared libraries for libsrt.so which uses MPL license. +SRS_SHARED_SRT=NO # whether enable the gcov SRS_GCOV=NO # whether enable the log verbose/info/trace level. @@ -183,6 +187,8 @@ Conflicts: Experts: --use-sys-ssl Do not compile ssl, use system ssl(-lssl) if required. + --use-shared-st Use link shared libraries for ST which uses MPL license. + --use-shared-srt Use link shared libraries for SRT which uses MPL license. --export-librtmp-project= Export srs-librtmp to specified project in path. --export-librtmp-single= Export srs-librtmp to a single file(.h+.cpp) in path. @@ -272,6 +278,9 @@ function parse_user_option() { --full) SRS_ENABLE_ALL=YES ;; --use-sys-ssl) SRS_USE_SYS_SSL=YES ;; + --use-shared-st) SRS_SHARED_ST=YES ;; + --use-shared-srt) SRS_SHARED_SRT=YES ;; + --memory-watch) SRS_MEM_WATCH=YES ;; --export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;; --export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;; @@ -535,6 +544,8 @@ function regenerate_options() { if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi + if [ $SRS_SHARED_ST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --use-shared-st"; fi + if [ $SRS_SHARED_SRT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --use-shared-srt"; fi if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi diff --git a/trunk/auto/utest.sh b/trunk/auto/utest.sh index cb1a877c9..d8cce4a6f 100755 --- a/trunk/auto/utest.sh +++ b/trunk/auto/utest.sh @@ -167,7 +167,11 @@ echo "" >> ${FILE} echo "# link all depends libraries" >> ${FILE} echo -n "DEPS_LIBRARIES_FILES = " >> ${FILE} for item in ${ModuleLibFiles[*]}; do - echo -n "${SRS_TRUNK_PREFIX}/${item} " >> ${FILE} + if [[ -f ${item} ]]; then + echo -n "${SRS_TRUNK_PREFIX}/${item} " >> ${FILE} + else + echo -n "${item} " >> ${FILE} + fi done echo "" >> ${FILE}; echo "" >> ${FILE} # diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index b4f0f95c3..20c52ae13 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -196,7 +196,7 @@ stream_caster { # the caster type of stream, the casters: # mpegts_over_udp, MPEG-TS over UDP caster. # rtsp, Real Time Streaming Protocol (RTSP). - # flv, FLV over HTTP POST. + # flv, FLV over HTTP by POST. caster mpegts_over_udp; # the output rtmp url. # for mpegts_over_udp caster, the typically output url: diff --git a/trunk/configure b/trunk/configure index ad446a761..2f65cbbe2 100755 --- a/trunk/configure +++ b/trunk/configure @@ -147,6 +147,7 @@ END # # st(state-threads) the basic network library for SRS. LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a" +if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-lst"; fi # openssl-1.1.0e, for the RTMP complex handshake. LibSSLRoot="";LibSSLfile="" if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == NO ]]; then @@ -163,6 +164,7 @@ fi # srt code path if [[ $SRS_SRT == YES ]]; then LibSRTRoot="${SRS_WORKDIR}/src/srt"; LibSRTfile="${SRS_OBJS_DIR}/srt/lib/libsrt.a" + if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-lsrt"; fi fi # the link options, always use static link SrsLinkOptions="-ldl"; diff --git a/trunk/doc/README.md b/trunk/doc/README.md index 49a765648..29ee7b926 100644 --- a/trunk/doc/README.md +++ b/trunk/doc/README.md @@ -37,6 +37,12 @@ 1. [ICE, rfc5245-2010-ice.pdf](http://github.com/ossrs/srs/wiki/doc/rfc5245-2010-ice.pdf): https://tools.ietf.org/html/rfc5245 1. [SIP, rfc3261-2002-sip.pdf](http://github.com/ossrs/srs/wiki/doc/rfc3261-2002-sip.pdf): https://tools.ietf.org/html/rfc3261 +## SRT + +1. [Haivision_SRT_Open_Source_White_Paper.pdf](http://github.com/ossrs/srs/wiki/doc/Haivision_SRT_Open_Source_White_Paper.pdf) +1. [SRT_Alliance_Deployment_Guide.pdf](http://github.com/ossrs/srs/wiki/doc/SRT_Alliance_Deployment_Guide.pdf) +1. [SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf](http://github.com/ossrs/srs/wiki/doc/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf) + ## Others 1. [kafka-160915-0553-82964.pdf](http://github.com/ossrs/srs/wiki/doc/kafka-160915-0553-82964.pdf), https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 72ec535ca..7470acf2a 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -751,11 +751,9 @@ srs_error_t SrsHlsMuxer::_refresh_m3u8(string m3u8_file) // #EXTM3U\n // #EXT-X-VERSION:3\n - // #EXT-X-ALLOW-CACHE:YES\n std::stringstream ss; - ss << "#EXTM3U" << SRS_CONSTS_LF - << "#EXT-X-VERSION:3" << SRS_CONSTS_LF - << "#EXT-X-ALLOW-CACHE:YES" << SRS_CONSTS_LF; + ss << "#EXTM3U" << SRS_CONSTS_LF; + ss << "#EXT-X-VERSION:3" << SRS_CONSTS_LF; // #EXT-X-MEDIA-SEQUENCE:4294967295\n SrsHlsSegment* first = dynamic_cast(segments->first()); diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index f48528015..3bf9e0c65 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -903,6 +903,11 @@ srs_error_t SrsOriginHub::cycle() return err; } +bool SrsOriginHub::active() +{ + return is_active; +} + srs_error_t SrsOriginHub::on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet) { srs_error_t err = srs_success; @@ -1047,6 +1052,12 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se srs_avc_level2str(c->avc_level).c_str(), c->width, c->height, c->video_data_rate / 1000, c->frame_rate, c->duration); } + + // Ignore video data when no sps/pps + // @bug https://github.com/ossrs/srs/issues/703#issuecomment-578393155 + if (format->vcodec && !format->vcodec->is_avc_codec_ok()) { + return err; + } if ((err = hls->on_video(msg, format)) != srs_success) { // apply the error strategy for hls. @@ -2452,10 +2463,10 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum consumer = new SrsConsumer(this, conn); consumers.push_back(consumer); - + srs_utime_t queue_size = _srs_config->get_queue_length(req->vhost); consumer->set_queue_size(queue_size); - + // if atc, update the sequence header to gop cache time. if (atc && !gop_cache->empty()) { if (meta->data()) { @@ -2468,22 +2479,25 @@ srs_error_t SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consum meta->ash()->timestamp = srsu2ms(gop_cache->start_time()); } } - - // Copy metadata and sequence header to consumer. - if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) { - return srs_error_wrap(err, "meta dumps"); + + // If stream is publishing, dumps the sequence header and gop cache. + if (hub->active()) { + // Copy metadata and sequence header to consumer. + if ((err = meta->dumps(consumer, atc, jitter_algorithm, dm, ds)) != srs_success) { + return srs_error_wrap(err, "meta dumps"); + } + + // copy gop cache to client. + if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) { + return srs_error_wrap(err, "gop cache dumps"); + } } - - // copy gop cache to client. - if (dg && (err = gop_cache->dump(consumer, atc, jitter_algorithm)) != srs_success) { - return srs_error_wrap(err, "gop cache dumps"); - } - + // print status. if (dg) { - srs_trace("create consumer, queue_size=%.2f, jitter=%d", queue_size, jitter_algorithm); + srs_trace("create consumer, active=%d, queue_size=%.2f, jitter=%d", hub->active(), queue_size, jitter_algorithm); } else { - srs_trace("create consumer, ignore gop cache, jitter=%d", jitter_algorithm); + srs_trace("create consumer, active=%d, ignore gop cache, jitter=%d", hub->active(), jitter_algorithm); } // for edge, when play edge stream, check the state diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index b0696346e..dba9540da 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -330,7 +330,6 @@ class SrsOriginHub : public ISrsReloadHandler private: SrsSource* source; SrsRequest* req; - // Whether the stream hub is active, or stream is publishing. bool is_active; private: // The format, codec information. @@ -364,6 +363,8 @@ public: // Cycle the hub, process some regular events, // For example, dispose hls in cycle. virtual srs_error_t cycle(); + // Whether the stream hub is active, or stream is publishing. + virtual bool active(); public: // When got a parsed metadata. virtual srs_error_t on_meta_data(SrsSharedPtrMessage* shared_metadata, SrsOnMetaDataPacket* packet); @@ -376,7 +377,7 @@ public: virtual srs_error_t on_publish(); // When stop publish stream. virtual void on_unpublish(); - // Internal callback. +// Internal callback. public: // For the SrsForwarder to callback to request the sequence headers. virtual srs_error_t on_forwarder_start(SrsForwarder* forwarder); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index d1febe177..0f8f8c3c7 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 1 +#define VERSION_REVISION 2 // The macros generated by configure script. #include