From e529536563670ef16fcf1f89e82996247ab22162 Mon Sep 17 00:00:00 2001 From: johzzy Date: Mon, 21 Nov 2022 22:01:01 +0800 Subject: [PATCH 1/2] WebRTC: Fix no audio and video issue for Firefox. (#3079) v4.0.268 * Remove extern SrsPps* duplicate declarations * fix(rtmp2rtc): fix video payload type for rtmp to rtc bridge (#3041) * Revert changes not belongs to this PR. * Fix naming issue, follow SRS style. * Use srs_assert instead of assert. * Fix firefox no audio issue. Co-authored-by: winlin --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_rtc_source.cpp | 16 ++++++++++------ trunk/src/app/srs_app_rtc_source.hpp | 2 ++ trunk/src/core/srs_core_version4.hpp | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index b1975172c..4c4372600 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-11-22, Pick [#3079](https://github.com/ossrs/srs/issues/3079): WebRTC: Fix no audio and video issue for Firefox. v4.0.268 * v4.0, 2022-10-10, For [#2901](https://github.com/ossrs/srs/issues/2901): Edge: Fast disconnect and reconnect. v4.0.267 * v4.0, 2022-09-27, For [#3167](https://github.com/ossrs/srs/issues/3167): WebRTC: Refine sequence jitter algorithm. v4.0.266 * v4.0, 2022-09-16, For [#3179](https://github.com/ossrs/srs/issues/3179): WebRTC: Make sure the same m-lines order for offer and answer. v4.0.265 diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index 26e6ee69a..d8c1856a6 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -722,6 +722,8 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source) if (!descs.empty()) { audio_ssrc = descs.at(0)->ssrc_; } + // Note we must use the PT of source, see https://github.com/ossrs/srs/pull/3079 + audio_payload_type_ = descs.empty() ? kAudioPayloadType : descs.front()->media_->pt_; } // video track ssrc @@ -730,6 +732,8 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source) if (!descs.empty()) { video_ssrc = descs.at(0)->ssrc_; } + // Note we must use the PT of source, see https://github.com/ossrs/srs/pull/3079 + video_payload_type_ = descs.empty() ? kVideoPayloadType : descs.front()->media_->pt_; } } @@ -900,7 +904,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_opus(SrsAudioFrame* audio, SrsRtpPack { srs_error_t err = srs_success; - pkt->header.set_payload_type(kAudioPayloadType); + pkt->header.set_payload_type(audio_payload_type_); pkt->header.set_ssrc(audio_ssrc); pkt->frame_type = SrsFrameTypeAudio; pkt->header.set_marker(true); @@ -1044,7 +1048,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcSource* source, SrsShare return srs_error_new(ERROR_RTC_RTP_MUXER, "sps/pps empty"); } - pkt->header.set_payload_type(kVideoPayloadType); + pkt->header.set_payload_type(video_payload_type_); pkt->header.set_ssrc(video_ssrc); pkt->frame_type = SrsFrameTypeVideo; pkt->nalu_type = (SrsAvcNaluType)kStapA; @@ -1126,7 +1130,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, const SrsRtpPacket* pkt = new SrsRtpPacket(); pkts.push_back(pkt); - pkt->header.set_payload_type(kVideoPayloadType); + pkt->header.set_payload_type(video_payload_type_); pkt->header.set_ssrc(video_ssrc); pkt->frame_type = SrsFrameTypeVideo; pkt->nalu_type = (SrsAvcNaluType)first_nalu_type; @@ -1160,7 +1164,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, const SrsRtpPacket* pkt = new SrsRtpPacket(); pkts.push_back(pkt); - pkt->header.set_payload_type(kVideoPayloadType); + pkt->header.set_payload_type(video_payload_type_); pkt->header.set_ssrc(video_ssrc); pkt->frame_type = SrsFrameTypeVideo; pkt->nalu_type = (SrsAvcNaluType)kFuA; @@ -1190,7 +1194,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_single_nalu(SrsSharedPtrMessage* msg, SrsRtpPacket* pkt = new SrsRtpPacket(); pkts.push_back(pkt); - pkt->header.set_payload_type(kVideoPayloadType); + pkt->header.set_payload_type(video_payload_type_); pkt->header.set_ssrc(video_ssrc); pkt->frame_type = SrsFrameTypeVideo; pkt->header.set_sequence(video_sequence++); @@ -1223,7 +1227,7 @@ srs_error_t SrsRtcFromRtmpBridger::package_fu_a(SrsSharedPtrMessage* msg, SrsSam SrsRtpPacket* pkt = new SrsRtpPacket(); pkts.push_back(pkt); - pkt->header.set_payload_type(kVideoPayloadType); + pkt->header.set_payload_type(video_payload_type_); pkt->header.set_ssrc(video_ssrc); pkt->frame_type = SrsFrameTypeVideo; pkt->header.set_sequence(video_sequence++); diff --git a/trunk/src/app/srs_app_rtc_source.hpp b/trunk/src/app/srs_app_rtc_source.hpp index 90728c8f4..b21bbd053 100644 --- a/trunk/src/app/srs_app_rtc_source.hpp +++ b/trunk/src/app/srs_app_rtc_source.hpp @@ -261,6 +261,8 @@ private: uint16_t video_sequence; uint32_t audio_ssrc; uint32_t video_ssrc; + uint8_t audio_payload_type_; + uint8_t video_payload_type_; public: SrsRtcFromRtmpBridger(SrsRtcSource* source); virtual ~SrsRtcFromRtmpBridger(); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 46076d8de..d26350ab1 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 267 +#define VERSION_REVISION 268 #endif From 2573a25101514f0e3d152b96cd33b31bd00e136d Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 22 Nov 2022 11:01:56 +0800 Subject: [PATCH 2/2] Release v4.0-r4, 4.0 release4, v4.0.268, 145482 lines. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6e9ef5417..e7eccc83a 100755 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ A big THANK YOU goes to: ## Releases +* 2022-11-22, Release [v4.0-r4](https://github.com/ossrs/srs/releases/tag/v4.0-r4), v4.0-r4, 4.0 release4, v4.0.268, 145482 lines. * 2022-09-16, Release [v4.0-r3](https://github.com/ossrs/srs/releases/tag/v4.0-r3), v4.0-r3, 4.0 release3, v4.0.265, 145328 lines. * 2022-08-24, Release [v4.0-r2](https://github.com/ossrs/srs/releases/tag/v4.0-r2), v4.0-r2, 4.0 release2, v4.0.257, 144890 lines. * 2022-06-29, Release [v4.0-r1](https://github.com/ossrs/srs/releases/tag/v4.0-r1), v4.0-r1, 4.0 release1, v4.0.253, 144680 lines.