diff --git a/README.md b/README.md index dc0fdd50e8..db8acbee8f 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ #Simple-RTMP-Server +SRS/1.0,开发代号:[HuKaiqun](https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_Product#release10) + SRS定位是运营级的互联网直播服务器集群,追求更好的概念完整性和最简单实现的代码。 下载发布版(github): -[Centos6-x86_64](http://winlinvip.github.io/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.21.zip) +[Centos6-x86_64](http://winlinvip.github.io/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.27.zip) 其他[more...](http://winlinvip.github.io/srs.release/releases/)
下载发布版(国内阿里云镜像): -[Centos6-x86_64](http://www.ossrs.net/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.21.zip) +[Centos6-x86_64](http://www.ossrs.net/srs.release/releases/files/SRS-CentOS6-x86_64-1.0.27.zip) 其他[more...](http://www.ossrs.net/srs.release/releases/)
QQ群: 365936885, by wenjie
同类产品:[BLS](https://github.com/wenjiegit/Bull-Live-Server)/[BLE](https://github.com/wenjiegit/Bull-Live-Encoder), [NGINX-RTMP](https://github.com/arut/nginx-rtmp-module), [CRTMPD](http://www.rtmpd.com/), [RED5](http://www.red5.org/), [WOWZA](http://www.wowza.com/), [FMS/AMS](http://www.adobe.com/products/adobe-media-server-standard.html) @@ -362,6 +364,7 @@ Supported operating systems and hardware: [2.0dev branch](https://github.com/winlinvip/simple-rtmp-server/tree/master). ## Releases +* 2015-02-12, [Release v1.0r2](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r2), bug fixed, 1.0.27, 59507 lines.
* 2015-01-15, [Release v1.0r1](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r1), bug fixed, 1.0.21, 59472 lines.
* 2014-12-05, [Release v1.0](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0), all bug fixed, 1.0.10, 59391 lines.
* 2014-10-09, [Release v1.0-beta](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.beta), all bug fixed, 1.0.0, 59316 lines.
@@ -384,6 +387,14 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History + +* v1.0, 2015-02-12, [1.0r2 release(1.0.27)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r2) released. 59507 lines. +* v1.0, 2015-02-11, dev code HuKaiqun for 1.0.27. +* v1.0, 2015-02-10, for [#310](https://github.com/winlinvip/simple-rtmp-server/issues/310), the aac profile must be object plus one. 1.0.26 +* v1.0, 2015-01-25, hotfix [#268](https://github.com/winlinvip/simple-rtmp-server/issues/268), refine the pcr start at 0, dts/pts plus delay. 1.0.25 +* v1.0, 2015-01-25, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), refine pcr=dts-800ms and use dts/pts directly. 1.0.24 +* v1.0, 2015-01-23, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), use absolutely overflow to make jwplayer happy. 1.0.23 +* v1.0, 2015-01-17, hotfix [#290](https://github.com/winlinvip/simple-rtmp-server/issues/290), use iformat only for rtmp input. 1.0.22 * v1.0, 2015-01-15, [1.0r1 release(1.0.21)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r1) released. 59472 lines. * v1.0, 2015-01-08, hotfix [#281](https://github.com/winlinvip/simple-rtmp-server/issues/281), fix hls bug ignore type-9 send aud. 1.0.20 * v1.0, 2015-01-03, hotfix to remove the pageUrl for http callback. 1.0.19 diff --git a/trunk/src/app/srs_app_avc_aac.cpp b/trunk/src/app/srs_app_avc_aac.cpp index 1611b58195..cfb861eb48 100644 --- a/trunk/src/app/srs_app_avc_aac.cpp +++ b/trunk/src/app/srs_app_avc_aac.cpp @@ -247,6 +247,13 @@ int SrsAvcAacCodec::audio_aac_demux(char* data, int size, SrsCodecSample* sample return ret; } + // the profile = object_id + 1 + // @see aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 78, + // Table 1. A.9 C MPEG-2 Audio profiles and MPEG-4 Audio object types + // so the aac_profile should plus 1, not minus 1, and nginx-rtmp used it to + // downcast aac SSR to LC. + // @see https://github.com/winlinvip/simple-rtmp-server/issues/310 + // TODO: FIXME: fix the following in future version. // aac_profile = audioObjectType - 1 aac_profile--; diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp index b85585f453..02ee571da9 100644 --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -222,7 +222,7 @@ int SrsEdgeIngester::connect_app(string ep_server, string ep_port) // @see https://github.com/winlinvip/simple-rtmp-server/issues/147 SrsAmf0Object* data = req->args; data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY)); - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER)); data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE)); data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE)); data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL)); @@ -654,7 +654,7 @@ int SrsEdgeForwarder::connect_app(string ep_server, string ep_port) // @see https://github.com/winlinvip/simple-rtmp-server/issues/147 SrsAmf0Object* data = req->args; data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY)); - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER)); data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE)); data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE)); data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL)); diff --git a/trunk/src/app/srs_app_ffmpeg.cpp b/trunk/src/app/srs_app_ffmpeg.cpp index 7ecbd0228a..f5a87fd02b 100644 --- a/trunk/src/app/srs_app_ffmpeg.cpp +++ b/trunk/src/app/srs_app_ffmpeg.cpp @@ -209,6 +209,13 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine) return ret; } + // for not rtmp input, donot append the iformat, + // for example, "-f flv" before "-i udp://192.168.1.252:2222" + // @see https://github.com/winlinvip/simple-rtmp-server/issues/290 + if (input.find("rtmp://") != 0) { + iformat = ""; + } + return ret; } diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index 5f45051505..d819061b73 100644 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -336,7 +336,7 @@ int SrsForwarder::connect_app(string ep_server, string ep_port) // @see https://github.com/winlinvip/simple-rtmp-server/issues/147 SrsAmf0Object* data = req->args; data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY)); - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER)); data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE)); data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE)); data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL)); diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index af294ddb2b..be90a12199 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -78,7 +78,9 @@ using namespace std; // @see: NGX_RTMP_HLS_DELAY, // 63000: 700ms, ts_tbn=90000 -#define SRS_AUTO_HLS_DELAY 63000 +// 72000: 800ms, ts_tbn=90000 +// @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511 +#define SRS_AUTO_HLS_DELAY 72000 // the mpegts header specifed the video/audio pid. #define TS_VIDEO_PID 256 @@ -237,7 +239,8 @@ class SrsMpegtsWriter p[-1] |= 0x20; // Both Adaption and Payload *p++ = 7; // size *p++ = 0x50; // random access + PCR - p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); + // about the pcr, read https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511 + p = write_pcr(p, frame->dts); } // PES header @@ -368,10 +371,12 @@ class SrsMpegtsWriter } static char* write_pcr(char* p, int64_t pcr) { - // the pcr=dts-delay - // and the pcr maybe negative + // the pcr=dts-delay, where dts = frame->dts + delay + // and the pcr should never be negative // @see https://github.com/winlinvip/simple-rtmp-server/issues/268 - int64_t v = srs_max(0, pcr); + srs_assert(pcr >= 0); + + int64_t v = pcr; *p++ = (char) (v >> 25); *p++ = (char) (v >> 17); @@ -655,10 +660,15 @@ int SrsHlsMuxer::on_sequence_header() bool SrsHlsMuxer::is_segment_overflow() { srs_assert(current); - return current->duration >= hls_fragment; } +bool SrsHlsMuxer::is_segment_absolutely_overflow() +{ + srs_assert(current); + return current->duration >= 2 * hls_fragment; +} + int SrsHlsMuxer::flush_audio(SrsMpegtsFrame* af, SrsBuffer* ab) { int ret = ERROR_SUCCESS; @@ -1090,7 +1100,9 @@ int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t // pure audio again for audio disabled. // so we reap event when the audio incoming when segment overflow. // @see https://github.com/winlinvip/simple-rtmp-server/issues/151 - if (muxer->is_segment_overflow()) { + // we use absolutely overflow of segment to make jwplayer/ffplay happy + // @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71155184 + if (muxer->is_segment_absolutely_overflow()) { if ((ret = reap_segment("audio", muxer, af->pts)) != ERROR_SUCCESS) { return ret; } diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index d31820367a..fff25c90bc 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -192,10 +192,16 @@ class SrsHlsMuxer virtual int segment_open(int64_t segment_start_dts); virtual int on_sequence_header(); /** - * whether video overflow, - * that is whether the current segment duration >= the segment in config + * whether segment overflow, + * that is whether the current segment duration>=(the segment in config) */ virtual bool is_segment_overflow(); + /** + * whether segment absolutely overflow, for pure audio to reap segment, + * that is whether the current segment duration>=2*(the segment in config) + * @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71155184 + */ + virtual bool is_segment_absolutely_overflow(); virtual int flush_audio(SrsMpegtsFrame* af, SrsBuffer* ab); virtual int flush_video(SrsMpegtsFrame* af, SrsBuffer* ab, SrsMpegtsFrame* vf, SrsBuffer* vb); /** diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index c1f4352ad5..cdc0f4ee97 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -956,7 +956,7 @@ int SrsSource::on_meta_data(SrsMessage* msg, SrsOnMetaDataPacket* metadata) } // add server info to metadata - metadata->metadata->set("server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + metadata->metadata->set("server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER)); metadata->metadata->set("primary", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY)); metadata->metadata->set("authors", SrsAmf0Any::str(RTMP_SIG_SRS_AUTHROS)); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 3b9d7b755f..6109a64545 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,9 +31,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 1 #define VERSION_MINOR 0 -#define VERSION_REVISION 21 +#define VERSION_REVISION 27 + // server info. #define RTMP_SIG_SRS_KEY "SRS" +#define RTMP_SIG_SRS_CODE "HuKaiqun" #define RTMP_SIG_SRS_ROLE "origin/edge server" #define RTMP_SIG_SRS_NAME RTMP_SIG_SRS_KEY"(Simple RTMP Server)" #define RTMP_SIG_SRS_URL_SHORT "github.com/winlinvip/simple-rtmp-server" @@ -49,6 +51,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RTMP_SIG_SRS_RELEASE "https://github.com/winlinvip/simple-rtmp-server/tree/1.0release" #define RTMP_SIG_SRS_HTTP_SERVER "https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_HTTPServer#feature" #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")" // internal macros, covert macro values to str, // see: read https://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification diff --git a/trunk/src/rtmp/srs_protocol_rtmp.cpp b/trunk/src/rtmp/srs_protocol_rtmp.cpp index 8fc2df48b6..3af25e5315 100644 --- a/trunk/src/rtmp/srs_protocol_rtmp.cpp +++ b/trunk/src/rtmp/srs_protocol_rtmp.cpp @@ -905,7 +905,7 @@ int SrsRtmpServer::response_connect_app(SrsRequest *req, const char* server_ip) data->set("version", SrsAmf0Any::str(RTMP_SIG_FMS_VER)); data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY)); - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")")); + data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_SERVER)); data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE)); data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE)); data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL));