ZLMedia中track的建立(2)--视频
h264编码track的建立,从rtmp中sprop-parameter-sets中取出经过base64编码过后的sps和pps,经解码以后得到sps和pps,然后根据sps和pps建立track.
序列参数集(SPS)
图像参数集(PPS)
case CodecH264 : { //a=fmtp:96 packetization-mode=1;profile-level-id=42C01F;sprop-parameter-sets=Z0LAH9oBQBboQAAAAwBAAAAPI8YMqA==,aM48gA== auto map = Parser::parseArgs(track->_fmtp, ";", "="); auto sps_pps = map["sprop-parameter-sets"]; string base64_SPS = FindField(sps_pps.data(), NULL, ","); string base64_PPS = FindField(sps_pps.data(), ",", NULL); auto sps = decodeBase64(base64_SPS); auto pps = decodeBase64(base64_PPS); if (sps.empty() || pps.empty()) { //如果sdp里面没有sps/pps,那么可能在后续的rtp里面恢复出sps/pps return std::make_shared<H264Track>(); } return std::make_shared<H264Track>(sps, pps, 0, 0); }