Skip to content

Commit

Permalink
For #1998, fix fetch remote payload bug. 4.0.56
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 13, 2020
1 parent 4650d47 commit 5d27c62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2957,15 +2957,15 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRequest* req, const S
}

std::vector<SrsRtcTrackDescription*> track_descs;
SrsMediaPayloadType* remote_payload = NULL;
SrsMediaPayloadType remote_payload(0);
if (remote_media_desc.is_audio()) {
// TODO: check opus format specific param
vector<SrsMediaPayloadType> payloads = remote_media_desc.find_media_with_encoding_name("opus");
if (payloads.empty()) {
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
Expand All @@ -2974,23 +2974,25 @@ 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");
}

for (int i = 0; i < (int)track_descs.size(); ++i) {
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_;
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 @@ -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

0 comments on commit 5d27c62

Please sign in to comment.