Commit 00334b97 by xiongziliang

初步完成265的rtp解包

parent 946b00f4
...@@ -93,7 +93,6 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) { ...@@ -93,7 +93,6 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
const uint8_t *frame = (uint8_t *) rtppack->payload + rtppack->offset; const uint8_t *frame = (uint8_t *) rtppack->payload + rtppack->offset;
int length = rtppack->length - rtppack->offset; int length = rtppack->length - rtppack->offset;
int nal = H265_TYPE(frame[0]); int nal = H265_TYPE(frame[0]);
if (nal > 50){ if (nal > 50){
...@@ -108,13 +107,13 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) { ...@@ -108,13 +107,13 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
case 49: { case 49: {
// fragmentation unit (FU) // fragmentation unit (FU)
FU fu; FU fu;
MakeFU(frame[1], fu); MakeFU(frame[2], fu);
if (fu.S == 1) { if (fu.S == 1) {
//FU-A start //FU-A start
_h265frame->buffer.assign("\x0\x0\x0\x1", 4); _h265frame->buffer.assign("\x0\x0\x0\x1", 4);
_h265frame->buffer.push_back(fu.type << 1); _h265frame->buffer.push_back(fu.type << 1);
_h265frame->buffer.push_back(0x01); _h265frame->buffer.push_back(0x01);
_h265frame->buffer.append((char *) frame + 2, length - 2); _h265frame->buffer.append((char *) frame + 3, length - 3);
_h265frame->type = fu.type; _h265frame->type = fu.type;
_h265frame->timeStamp = rtppack->timeStamp; _h265frame->timeStamp = rtppack->timeStamp;
_h265frame->sequence = rtppack->sequence; _h265frame->sequence = rtppack->sequence;
...@@ -129,14 +128,14 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) { ...@@ -129,14 +128,14 @@ bool H265RtpDecoder::decodeRtp(const RtpPacket::Ptr &rtppack) {
_h265frame->sequence = rtppack->sequence; _h265frame->sequence = rtppack->sequence;
if (fu.E == 1) { if (fu.E == 1) {
//FU-A end //FU-A end
_h265frame->buffer.append((char *) frame + 2, length - 2); _h265frame->buffer.append((char *) frame + 3, length - 3);
_h265frame->timeStamp = rtppack->timeStamp; _h265frame->timeStamp = rtppack->timeStamp;
auto isIDR = _h265frame->keyFrame(); auto isIDR = _h265frame->keyFrame();
onGetH265(_h265frame); onGetH265(_h265frame);
return isIDR; return isIDR;
} }
//FU-A mid //FU-A mid
_h265frame->buffer.append((char *) frame + 2, length - 2); _h265frame->buffer.append((char *) frame + 3, length - 3);
return false; return false;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论