客户端主要出错信息:
MultiFramedRTPSource error: Hit limit when reading incoming packet over TCP. Increase \"MAX_PACKET_SIZE\"
RTCPInstance error: Hit limit [1450,1450] when reading incoming packet over TCP. Increase "maxRTCPPacketSize"
live555源码修改记录
服务器端:
针对1080P高清H264码率过大,需要修改live/mediaServer/DynamicRTSPServer.cpp文件中第117行
OutPacketBuffer::maxSize = 1024*1024; // allow for some possibly large H.264 frames
maxSize的值,具体大小可根据实际播放画面质量和服务器打印的出错信息修改
针对服务器发送的RTP包出错,发送时超出系统TCP buffer大小,需修改:live/liveMedia/RTPInterface.cpp sendDataOverTCP()函数
修改为
makeSocketBlocking(socketNum);
int sendSuccess = loopsend(socketNum,data,dataSize);
makeSocketNonBlocking(socketNum);
if(sendSuccess == dataSize)
{
return True;
}
else
{
printf("send false...........\n");
return False;
}
需添加loopsend()函数
int loopsend(int sock, u_int8_t const* buf, unsigned int sndsize)
{
int remian = sndsize;
int sendlen = 0;
int ret = 0;
while(remian > 0)
{
ret=send(sock,buf+sendlen,remian,0);
if(ret <= 0)
{
printf("ret = %d\n",ret);
return ret;
}
sendlen += ret;
remian -= ret;
}
return sndsize;
}
客户端代码健壮性加强
修改live/liveMedia/RTPInterface.cpp 中tcpReadHandler1()函数
在case AWAITING_SIZE2:中
unsigned short size = (fSizeByte1<<8)|c;后添加RTP和RTCP包的大小判断
添加代码如下:
if(fStreamChannelId == 0x00)
if(size > 20000) //lcy add 20000为"MAX_PACKET_SIZE"值的大小(RTP包的最大值)
{
fTCPReadingState = AWAITING_DOLLAR;
break;
}
if(fStreamChannelId == 0x01)
if(size > 1450) //lcy add 1450为"maxRTCPPacketSize"值的大小(RTCP包的大小)
{
fTCPReadingState = AWAITING_DOLLAR;
break;
}
转自:http://www.whzlcx.com/details.htm?ID=18&did=662