Open fatalfeel opened 2 years ago
I fixed h264 h265 Invalid NAL unit 0, skipping buf fixed
#define MAX_RTP_PAYLOAD_SIZE 1440
//#define RTP_TCP_HEAD_SIZE 4 //when transportmode = RTP_OVER_TCP
#define RTP_TCP_HEAD_SIZE 0 //when transport_mode_ = RTP_OVER_UDP 2. H264Source.cpp if (frame_size <= MAX_RTP_PAYLOAD_SIZE) { frame_buf += 4; //shift to nalu position frame_size -= 4; RtpPacket rtp_pkt; rtp_pkt.type = frame.type; rtp_pkt.timestamp = frame.timestamp; rtp_pkt.size = frame_size + RTP_TCP_HEAD_SIZE + RTP_HEADER_SIZE; rtp_pkt.last = 1; ... } else { frame_buf += 4; //shift to nalu position frame_size -= 4; char FU_A[2] = {0}; FU_A[0] = (frame_buf[0] & 0xE0) | 28; FU_A[1] = 0x80 | (frame_buf[0] & 0x1F); } 3. H265Source.cpp if (frame_size <= MAX_RTP_PAYLOAD_SIZE) { frame_buf += 4; //shift to nalu position frame_size -= 4; RtpPacket rtp_pkt; rtp_pkt.type = frame.type; rtp_pkt.timestamp = frame.timestamp; rtp_pkt.size = frame_size + RTP_TCP_HEAD_SIZE + RTP_HEADER_SIZE; rtp_pkt.last = 1; ... } else { frame_buf += 4; //shift to nalu position frame_size -= 4; uint8_t PL_FU[3] = {0}; uint8_t nalUnitType = (frame_buf[0] & 0x7E) >> 1; PL_FU[0] = (frame_buf[0] & 0x81) | (49<<1); PL_FU[1] = frame_buf[1]; PL_FU[2] = 0x80 | nalUnitType; }
download fixed file here https://fatalfeel.blogspot.com/2013/12/rtsp-server-for-h264-h265-aac.html
I fixed h264 h265 Invalid NAL unit 0, skipping buf fixed
define MAX_RTP_PAYLOAD_SIZE 1420
//#define RTP_TCP_HEAD_SIZE 4 //when transportmode = RTP_OVER_TCP