From 86fcf69f8121d62aa182f185248b79c8b6f57e8f Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 25 Sep 2019 22:16:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=AB=98rtsp=E5=AF=B9H264=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=9A=84sdp=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/Factory.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index 0a504f64..aee7de21 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -60,16 +60,16 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) { } if (strcasecmp(track->_codec.data(), "h264") == 0) { - string sps_pps = FindField(track->_fmtp.data(), "sprop-parameter-sets=", nullptr); + auto map = Parser::parseArgs(track->_fmtp," ","="); + for(auto &pr : map){ + trim(pr.second," ;"); + } + auto sps_pps = map["sprop-parameter-sets"]; if(sps_pps.empty()){ return std::make_shared(); } string base64_SPS = FindField(sps_pps.data(), NULL, ","); string base64_PPS = FindField(sps_pps.data(), ",", NULL); - if(base64_PPS.back() == ';'){ - base64_PPS.pop_back(); - } - auto sps = decodeBase64(base64_SPS); auto pps = decodeBase64(base64_PPS); return std::make_shared(sps,pps,0,0);