解决ps rtp解包问题

This commit is contained in:
xiongziliang 2020-03-08 22:10:37 +08:00
parent 10884340b0
commit 502e3bff5f
3 changed files with 4 additions and 2 deletions

@ -1 +1 @@
Subproject commit 1603194dafdcecda9036e5741ec8d3e8c9ab1e01 Subproject commit 737b8d852eeb1a36bc77854f327fbbef7cfb81be

View File

@ -62,7 +62,7 @@ void RtpDecoder::decodeRtp(const void *data, int bytes) {
uint8_t rtp_type = 0x7F & ((uint8_t *) data)[1]; uint8_t rtp_type = 0x7F & ((uint8_t *) data)[1];
InfoL << "rtp type:" << (int) rtp_type; InfoL << "rtp type:" << (int) rtp_type;
_rtp_decoder = rtp_payload_decode_create(rtp_type, "MP4V-ES", &s_func, this); _rtp_decoder = rtp_payload_decode_create(rtp_type, "MP2P", &s_func, this);
if (!_rtp_decoder) { if (!_rtp_decoder) {
WarnL << "unsupported rtp type:" << (int) rtp_type << ",size:" << bytes << ",hexdump" << hexdump(data, bytes > 16 ? 16 : bytes); WarnL << "unsupported rtp type:" << (int) rtp_type << ",size:" << bytes << ",hexdump" << hexdump(data, bytes > 16 ? 16 : bytes);
} }

View File

@ -180,9 +180,11 @@ void RtpProcess::onRtpDecode(const uint8_t *packet, int bytes, uint32_t timestam
//创建解码器 //创建解码器
if(checkTS(packet, bytes)){ if(checkTS(packet, bytes)){
//猜测是ts负载 //猜测是ts负载
InfoL << "judged to be TS: " << printSSRC(_ssrc);
_decoder = Decoder::createDecoder(Decoder::decoder_ts); _decoder = Decoder::createDecoder(Decoder::decoder_ts);
}else{ }else{
//猜测是ps负载 //猜测是ps负载
InfoL << "judged to be PS: " << printSSRC(_ssrc);
_decoder = Decoder::createDecoder(Decoder::decoder_ps); _decoder = Decoder::createDecoder(Decoder::decoder_ps);
} }
_decoder->setOnDecode([this](int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes){ _decoder->setOnDecode([this](int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes){