feat: add H.265 profile parameters support for WebRTC SDP negotiation

This commit is contained in:
weishao
2025-08-20 18:28:40 +08:00
committed by 夏楚
parent 6f71dd39ca
commit ceb78bd54c
2 changed files with 117 additions and 3 deletions

View File

@@ -1845,7 +1845,8 @@ void RtcConfigure::setPlayRtspInfo(const string &sdp) {
}
}
static const string kProfile { "profile-level-id" };
static const string kH264Profile { "profile-level-id" };
static const string kH265Profile { "profile-id" };
static const string kMode { "packetization-mode" };
bool RtcConfigure::onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec) const {
@@ -1860,7 +1861,7 @@ bool RtcConfigure::onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec)
if (_rtsp_video_plan && codec == CodecH264 && getCodecId(_rtsp_video_plan->codec) == CodecH264) {
// h264时profile-level-id [AUTO-TRANSLATED:94a5f360]
// When h264, profile-level-id
if (strcasecmp(_rtsp_video_plan->fmtp[kProfile].data(), const_cast<RtcCodecPlan &>(plan).fmtp[kProfile].data())) {
if (strcasecmp(_rtsp_video_plan->fmtp[kH264Profile].data(), const_cast<RtcCodecPlan &>(plan).fmtp[kH264Profile].data())) {
// profile-level-id 不匹配 [AUTO-TRANSLATED:814ec4c4]
// profile-level-id does not match
return false;
@@ -1868,6 +1869,15 @@ bool RtcConfigure::onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec)
return true;
}
if (_rtsp_video_plan && codec == CodecH265 && getCodecId(_rtsp_video_plan->codec) == CodecH265) {
// h265时profile-id
if (strcasecmp(_rtsp_video_plan->fmtp[kH265Profile].data(), const_cast<RtcCodecPlan &>(plan).fmtp[kH265Profile].data())) {
// profile-id 不匹配
return false;
}
return true;
}
return true;
}