H264 profile比对不区分大小写

This commit is contained in:
xiongziliang 2021-04-06 23:46:45 +08:00
parent c9a20eda16
commit b5e6c12ee8
2 changed files with 4 additions and 4 deletions

View File

@ -1535,7 +1535,7 @@ static map<string, string, StrCaseCompare> toMap(const vector<std::pair<string/*
static const string kProfile{"profile-level-id"}; static const string kProfile{"profile-level-id"};
static const string kMode{"packetization-mode"}; static const string kMode{"packetization-mode"};
bool RtcConfigure::onMatchCodecPlan(const RtcCodecPlan &plan, CodecId codec){ bool RtcConfigure::onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec){
if (_rtsp_audio_plan && codec == getCodecId(_rtsp_audio_plan->codec)) { if (_rtsp_audio_plan && codec == getCodecId(_rtsp_audio_plan->codec)) {
if (plan.sample_rate != _rtsp_audio_plan->sample_rate || plan.channel != _rtsp_audio_plan->channel) { if (plan.sample_rate != _rtsp_audio_plan->sample_rate || plan.channel != _rtsp_audio_plan->channel) {
//音频采样率和通道数必须相同 //音频采样率和通道数必须相同
@ -1548,12 +1548,12 @@ bool RtcConfigure::onMatchCodecPlan(const RtcCodecPlan &plan, CodecId codec){
auto rtc_fmt_map = toMap(plan.fmtp); auto rtc_fmt_map = toMap(plan.fmtp);
auto rtsp_fmt_map = toMap(_rtsp_video_plan->fmtp); auto rtsp_fmt_map = toMap(_rtsp_video_plan->fmtp);
auto &profile = rtsp_fmt_map[kProfile]; auto &profile = rtsp_fmt_map[kProfile];
if (!profile.empty() && profile != rtc_fmt_map[kProfile]) { if (!profile.empty() && strcasecmp(profile.data(), rtc_fmt_map[kProfile].data())) {
//profile-level-id 不匹配 //profile-level-id 不匹配
return false; return false;
} }
auto &mode = rtsp_fmt_map[kMode]; auto &mode = rtsp_fmt_map[kMode];
if (!mode.empty() && mode != rtc_fmt_map[kMode]) { if (!mode.empty() && atoi(mode.data()) != atoi(rtc_fmt_map[kMode].data())) {
//packetization-mode不匹配 //packetization-mode不匹配
return false; return false;
} }

View File

@ -708,7 +708,7 @@ public:
private: private:
void matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure); void matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure);
bool onMatchCodecPlan(const RtcCodecPlan &plan, CodecId codec); bool onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec);
private: private:
RtcCodecPlan::Ptr _rtsp_video_plan; RtcCodecPlan::Ptr _rtsp_video_plan;