修复长度没赋值导致帧序列乱掉

master
a74589669 2019-09-21 00:03:41 +08:00
parent 85e78c028c
commit f9b2b3dda8
1 changed files with 4 additions and 1 deletions

View File

@ -163,6 +163,8 @@ int Pack264AndSend(unsigned char *frame,int size,RtspClient * p){
identifier.FUType = frame[4]&0x1f; //sps or pps
identifier.NRI = (frame[4]&0xe0)>>5;
identifier.F = 0;
rtspInterleavedFrameHeader.length = htons(size - 5 + sizeof(FuIdentifier) + sizeof(CRtpHeader) );
int index = 0;
memcpy(sendBuf,&rtspInterleavedFrameHeader,sizeof(rtspInterleavedFrameHeader));
index += sizeof(rtspInterleavedFrameHeader);
@ -191,7 +193,8 @@ int Pack264AndSend(unsigned char *frame,int size,RtspClient * p){
rtspInterleavedFrameHeader.length = htons(MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader));
}else{
sendLength = (size - 5)%MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader) + sizeof(RtspInterleavedFrameHeader);
rtspInterleavedFrameHeader.length = htons((size - 5)%MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader));
printf("last package send %d length\r\n",sendLength);
rtspInterleavedFrameHeader.length = htons((size - 5)%MAX_RTP_LEN + sizeof(CH264NalUnit) + sizeof(CRtpHeader));
}
nalUnit.Header.End = 1;
nalUnit.Header.Start = 0;