From 4ca7684e36fce3db535d7a74b1bf125df3965038 Mon Sep 17 00:00:00 2001 From: Jay <39650910+w41203208@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:15:06 +0800 Subject: [PATCH] RTC: Fix video and audio track pt_ is not change in player before publisher. v5.0.207 v6.0.111 (#3925) For WebRTC: when player before publisher, it will happen track pt didn't change. - At source change step, change track pt --------- Co-authored-by: mingche.tsai Co-authored-by: john --- trunk/doc/CHANGELOG.md | 2 ++ trunk/src/app/srs_app_rtc_conn.cpp | 18 ++++++++++++++++++ trunk/src/core/srs_core_version5.hpp | 2 +- trunk/src/core/srs_core_version6.hpp | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 00c3eae55..4e7fadd56 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 6.0 Changelog +* v6.0, 2024-02-05, Merge [#3925](https://github.com/ossrs/srs/pull/3925): RTC: Fix video and audio track pt_ is not change in player before publisher. v6.0.111 (#3925) * v6.0, 2024-02-05, Merge [#3923](https://github.com/ossrs/srs/pull/3923): Configure: print enabled/disable sanitizer. v6.0.110 (#3923) * v6.0, 2023-12-30, Merge [#3916](https://github.com/ossrs/srs/pull/3916): Enhancing the compatibility of options.sh. v6.0.108 (#3916) * v6.0, 2023-12-30, Merge [#3914](https://github.com/ossrs/srs/pull/3914): Forward: when unpublish crash caused by uninitialized forward connection. v6.0.107 (#3914) @@ -121,6 +122,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2024-02-05, Merge [#3925](https://github.com/ossrs/srs/pull/3925): RTC: Fix video and audio track pt_ is not change in player before publisher. v5.0.207 (#3925) * v5.0, 2024-02-05, Merge [#3923](https://github.com/ossrs/srs/pull/3923): Configure: print enabled/disable sanitizer. v5.0.206 (#3923) * v5.0, 2023-12-30, Merge [#3916](https://github.com/ossrs/srs/pull/3916): Enhancing the compatibility of options.sh. v5.0.204 (#3916) * v5.0, 2023-12-14, Merge [#3910](https://github.com/ossrs/srs/pull/3910): RTC: Support OPUS stereo SDP option. v5.0.203 (#3910) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 8b474e991..b243c75f8 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -534,6 +534,15 @@ void SrsRtcPlayStream::on_stream_change(SrsRtcSourceDescription* desc) uint32_t ssrc = desc->audio_track_desc_->ssrc_; SrsRtcAudioSendTrack* track = audio_tracks_.begin()->second; + if (track->track_desc_->media_->pt_of_publisher_ != desc->audio_track_desc_->media_->pt_) { + track->track_desc_->media_->pt_of_publisher_ = desc->audio_track_desc_->media_->pt_; + } + + if (desc->audio_track_desc_->red_ && track->track_desc_->red_ && + track->track_desc_->red_->pt_of_publisher_ != desc->audio_track_desc_->red_->pt_) { + track->track_desc_->red_->pt_of_publisher_ = desc->audio_track_desc_->red_->pt_; + } + audio_tracks_.clear(); audio_tracks_.insert(make_pair(ssrc, track)); } @@ -547,6 +556,15 @@ void SrsRtcPlayStream::on_stream_change(SrsRtcSourceDescription* desc) uint32_t ssrc = vdesc->ssrc_; SrsRtcVideoSendTrack* track = video_tracks_.begin()->second; + if (track->track_desc_->media_->pt_of_publisher_ != vdesc->media_->pt_) { + track->track_desc_->media_->pt_of_publisher_ = vdesc->media_->pt_; + } + + if (vdesc->red_ && track->track_desc_->red_ && + track->track_desc_->red_->pt_of_publisher_ != vdesc->red_->pt_) { + track->track_desc_->red_->pt_of_publisher_ = vdesc->red_->pt_; + } + video_tracks_.clear(); video_tracks_.insert(make_pair(ssrc, track)); } diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index d6b30f77a..4fce369da 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 206 +#define VERSION_REVISION 207 #endif diff --git a/trunk/src/core/srs_core_version6.hpp b/trunk/src/core/srs_core_version6.hpp index 55270cf32..d1b1f7a23 100644 --- a/trunk/src/core/srs_core_version6.hpp +++ b/trunk/src/core/srs_core_version6.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_REVISION 110 +#define VERSION_REVISION 111 #endif