Skip to content

Commit

Permalink
WebRTC: Fix no audio and video issue for Firefox. (#3079) v4.0.268
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
johzzy and winlinvip committed Nov 22, 2022
1 parent 7d782ee commit e529536
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_;
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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++);
Expand Down Expand Up @@ -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++);
Expand Down
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_rtc_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ class SrsRtcFromRtmpBridger : public ISrsLiveSourceBridger
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();
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 @@ -9,6 +9,6 @@

#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 267
#define VERSION_REVISION 268

#endif

0 comments on commit e529536

Please sign in to comment.