From 5d27c62e95cab47c247ed6cdd3a9f311b4993e94 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 13 Nov 2020 08:48:51 +0800 Subject: [PATCH] For #1998, fix fetch remote payload bug. 4.0.56 --- trunk/src/app/srs_app_rtc_conn.cpp | 10 ++++++---- trunk/src/core/srs_core_version4.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 5dd1806f94..d9943c736a 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -2957,7 +2957,7 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRequest* req, const S } std::vector track_descs; - SrsMediaPayloadType* remote_payload = NULL; + SrsMediaPayloadType remote_payload(0); if (remote_media_desc.is_audio()) { // TODO: check opus format specific param vector payloads = remote_media_desc.find_media_with_encoding_name("opus"); @@ -2965,7 +2965,7 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRequest* req, const S return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no valid found opus payload type"); } - remote_payload = &payloads.at(0); + remote_payload = payloads.at(0); track_descs = source->get_track_desc("audio", "opus"); } else if (remote_media_desc.is_video()) { // TODO: check opus format specific param @@ -2974,15 +2974,17 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRequest* req, const S return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no valid found h264 payload type"); } + remote_payload = payloads.at(0); for (int j = 0; j < (int)payloads.size(); j++) { SrsMediaPayloadType& payload = payloads.at(j); // If exists 42e01f profile, choose it; otherwise, use the first payload. if (!has_42e01f || srs_sdp_has_h264_profile(payload, "42e01f")) { - remote_payload = &payloads.at(j); + remote_payload = payload; break; } } + track_descs = source->get_track_desc("video", "H264"); } @@ -2990,7 +2992,7 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRequest* req, const S SrsRtcTrackDescription* track = track_descs[i]->copy(); // Use remote/source/offer PayloadType. - track->media_->pt_ = remote_payload->payload_type_; + track->media_->pt_ = remote_payload.payload_type_; track->mid_ = remote_media_desc.mid_; uint32_t publish_ssrc = track->ssrc_; diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index c6c5056234..9fb9d17748 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 55 +#define SRS_VERSION4_REVISION 56 #endif