From 237c1e4d3d7d70eb5e49f07e059ab509ca6eb83f Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 5 Apr 2021 08:29:29 +0800 Subject: [PATCH 1/3] SquashSRS4: Fix DTLS warnings for HTTP api --- trunk/src/app/srs_app_rtc_dtls.cpp | 55 +++++++++++++++++++++++++++++- trunk/src/app/srs_app_rtc_dtls.hpp | 19 +++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_rtc_dtls.cpp b/trunk/src/app/srs_app_rtc_dtls.cpp index a528f2631..dbb17a685 100644 --- a/trunk/src/app/srs_app_rtc_dtls.cpp +++ b/trunk/src/app/srs_app_rtc_dtls.cpp @@ -961,10 +961,63 @@ bool SrsDtlsServerImpl::is_dtls_client() return false; } +SrsDtlsEmptyImpl::SrsDtlsEmptyImpl() : SrsDtlsImpl(NULL) +{ + handshake_done_for_us = true; +} + +SrsDtlsEmptyImpl::~SrsDtlsEmptyImpl() +{ +} + +srs_error_t SrsDtlsEmptyImpl::initialize(std::string version, std::string role) +{ + return srs_success; +} + +srs_error_t SrsDtlsEmptyImpl::start_active_handshake() +{ + return srs_success; +} + +bool SrsDtlsEmptyImpl::should_reset_timer() +{ + return false; +} + +srs_error_t SrsDtlsEmptyImpl::on_dtls(char* data, int nb_data) +{ + return srs_success; +} + +srs_error_t SrsDtlsEmptyImpl::get_srtp_key(std::string& recv_key, std::string& send_key) +{ + return srs_success; +} + +void SrsDtlsEmptyImpl::callback_by_ssl(std::string type, std::string desc) +{ +} + +srs_error_t SrsDtlsEmptyImpl::on_final_out_data(uint8_t* data, int size) +{ + return srs_success; +} + +srs_error_t SrsDtlsEmptyImpl::on_handshake_done() +{ + return srs_success; +} + +bool SrsDtlsEmptyImpl::is_dtls_client() +{ + return false; +} + SrsDtls::SrsDtls(ISrsDtlsCallback* callback) { callback_ = callback; - impl = new SrsDtlsServerImpl(callback); + impl = new SrsDtlsEmptyImpl(); } SrsDtls::~SrsDtls() diff --git a/trunk/src/app/srs_app_rtc_dtls.hpp b/trunk/src/app/srs_app_rtc_dtls.hpp index 61916a72f..56a6d8459 100644 --- a/trunk/src/app/srs_app_rtc_dtls.hpp +++ b/trunk/src/app/srs_app_rtc_dtls.hpp @@ -190,6 +190,25 @@ protected: virtual bool is_dtls_client(); }; +class SrsDtlsEmptyImpl : public SrsDtlsImpl +{ +public: + SrsDtlsEmptyImpl(); + virtual ~SrsDtlsEmptyImpl(); +public: + virtual srs_error_t initialize(std::string version, std::string role); + virtual srs_error_t start_active_handshake(); + virtual bool should_reset_timer(); + virtual srs_error_t on_dtls(char* data, int nb_data); +public: + srs_error_t get_srtp_key(std::string& recv_key, std::string& send_key); + void callback_by_ssl(std::string type, std::string desc); +protected: + virtual srs_error_t on_final_out_data(uint8_t* data, int size); + virtual srs_error_t on_handshake_done(); + virtual bool is_dtls_client(); +}; + class SrsDtls { private: From 1ee77614fbdbdd9f9db8fe60b76e093c1370f14c Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 5 Apr 2021 12:14:26 +0800 Subject: [PATCH 2/3] Refine comments --- trunk/3rdparty/st-srs/io.c | 2 +- .../players/srs_player/src/HlsNetStream.as | 14 +++++++------- trunk/scripts/git.commit.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/trunk/3rdparty/st-srs/io.c b/trunk/3rdparty/st-srs/io.c index da9184091..ccd969fd7 100644 --- a/trunk/3rdparty/st-srs/io.c +++ b/trunk/3rdparty/st-srs/io.c @@ -112,7 +112,7 @@ int _st_io_init(void) /** * by SRS, for osx. * when rlimit max is negative, for example, osx, use cur directly. - * @see https://github.com/winlinvip/simple-rtmp-server/issues/336 + * @see https://github.com/ossrs/srs/issues/336 */ if ((int)rlim.rlim_max < 0) { _st_osfd_limit = (int)(fdlim > 0? fdlim : rlim.rlim_cur); diff --git a/trunk/research/players/srs_player/src/HlsNetStream.as b/trunk/research/players/srs_player/src/HlsNetStream.as index 553741bb1..f0837780b 100755 --- a/trunk/research/players/srs_player/src/HlsNetStream.as +++ b/trunk/research/players/srs_player/src/HlsNetStream.as @@ -1369,7 +1369,7 @@ class SrsTsHanlder implements ISrsTsHandler private function write_h264_ipb_frame(ibps:ByteArray, frame_type:uint, dts:uint, pts:uint, piece:ByteArray):void { // when sps or pps not sent, ignore the packet. - // @see https://github.com/winlinvip/simple-rtmp-server/issues/203 + // @see https://github.com/ossrs/srs/issues/203 if (video_sh_tag.length == 0) { return; } @@ -2197,7 +2197,7 @@ class SrsRawAacStream // decode the ADTS. // @see aac-iso-13818-7.pdf, page 26 // 6.2 Audio Data Transport Stream, ADTS - // @see https://github.com/winlinvip/simple-rtmp-server/issues/212#issuecomment-64145885 + // @see https://github.com/ossrs/srs/issues/212#issuecomment-64145885 // byte_alignment() // adts_fixed_header: @@ -2260,7 +2260,7 @@ class SrsRawAacStream var channel_configuration:uint = (sfiv >> 6) & 0x07; /*int8_t original = (sfiv >> 5) & 0x01;*/ /*int8_t home = (sfiv >> 4) & 0x01;*/ - //int8_t Emphasis; @remark, Emphasis is removed, @see https://github.com/winlinvip/simple-rtmp-server/issues/212#issuecomment-64154736 + //int8_t Emphasis; @remark, Emphasis is removed, @see https://github.com/ossrs/srs/issues/212#issuecomment-64154736 // 4bits left. // adts_variable_header(), 1.A.2.2.2 Variable Header of ADTS // copyright_identification_bit 1 bslbf @@ -2357,7 +2357,7 @@ class SrsRawAacStream var samplingFrequencyIndex:uint = codec.sampling_frequency_index; // override the aac samplerate by user specified. - // @see https://github.com/winlinvip/simple-rtmp-server/issues/212#issuecomment-64146899 + // @see https://github.com/ossrs/srs/issues/212#issuecomment-64146899 switch (codec.sound_rate) { case SrsConsts.SrsCodecAudioSampleRate11025: samplingFrequencyIndex = 0x0a; break; @@ -2478,7 +2478,7 @@ class SrsEnum /** * the aac profile, for ADTS(HLS/TS) - * @see https://github.com/winlinvip/simple-rtmp-server/issues/310 + * @see https://github.com/ossrs/srs/issues/310 */ class SrsAacProfile extends SrsEnum { @@ -3697,7 +3697,7 @@ class SrsTsAdaptationField // @remark, for as, should never shift the Number object. // @remark, use pcr base and ignore the extension - // @see https://github.com/winlinvip/simple-rtmp-server/issues/250#issuecomment-71349370 + // @see https://github.com/ossrs/srs/issues/250#issuecomment-71349370 // first 33bits is pcr base. program_clock_reference_base = (stream.readUnsignedInt() << 1) & 0x1fffffe; var ch:uint = stream.readUnsignedByte(); @@ -3715,7 +3715,7 @@ class SrsTsAdaptationField } // @remark, for as, should never shift the Number object. // @remark, use pcr base and ignore the extension - // @see https://github.com/winlinvip/simple-rtmp-server/issues/250#issuecomment-71349370 + // @see https://github.com/ossrs/srs/issues/250#issuecomment-71349370 // first 33bits is pcr base. original_program_clock_reference_base = (stream.readUnsignedInt() << 1) & 0x1fffffe; ch = stream.readUnsignedByte(); diff --git a/trunk/scripts/git.commit.sh b/trunk/scripts/git.commit.sh index bed252315..978444896 100755 --- a/trunk/scripts/git.commit.sh +++ b/trunk/scripts/git.commit.sh @@ -45,7 +45,7 @@ function remote_check() ok_msg "remote $remote ok, url is $url" } remote_check origin git@github.com:ossrs/srs.git -remote_check srs.winlin git@github.com:winlinvip/simple-rtmp-server.git +remote_check srs.winlin git@github.com:winlinvip/srs.git remote_check srs.csdn git@code.csdn.net:winlinvip/srs-csdn.git remote_check srs.oschina git@git.oschina.net:winlinvip/srs.oschina.git remote_check srs.gitlab git@gitlab.com:winlinvip/srs-gitlab.git From 4871c616b8737c25e91c1d3dd9a13ebc5516449c Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 5 Apr 2021 12:47:21 +0800 Subject: [PATCH 3/3] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 51c96d79a..8e9941d95 100755 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ Other documents: > Remark: About the milestone and product plan, please read ([CN][v1_CN_Product], [EN][v1_EN_Product]) wiki. + ## V5 changes