live555直播h264异常优化:
MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (61140). 21339 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 81339, *before* creating this 'RTPSink'. (Current value is 60000.)
优化:
- 在“live/liveMedia/StreamParser.cpp”中扩展帧解析buffer大小,即BANK_SIZE,默认值为150k,根据传输的H264数据帧大小,至少设置为300k。否则超出大小,可能会被Live555抛弃。
- 在“live/liveMedia/MediaSink.cpp”中增加OutPacketBuffer::maxSize大小,同样为了容纳超大帧数据,否则可能会导致数据丢失,设置为 600000。
- 在“live/liveMedia/MultiFramedRTPsource.cpp”中--129行,增加socket发送缓冲区大小,即increaseSendBufferTo函数的参数值--increaseRecieveBufferTo(env, RTPgs-> socketNUm(), 2000000)”
在调度方面的优化:MultiFramedRTPSink::sendPacketIfNecessary--402行
#if 0
// We have more frames left to send. Figure out when the next frame
// is due to start playing, then make sure that we wait this long before
// sending the next packet.
struct timeval timeNow;
gettimeofday(&timeNow, NULL);
int secsDiff = fNextSendTime.tv_sec - timeNow.tv_sec;
int64_t uSecondsToGo = secsDiff*1000000 + (fNextSendTime.tv_usec - timeNow.tv_usec);
if (uSecondsToGo < 0 || secsDiff < 0) { // sanity check: Make sure that the time-to-delay is non-negative:
uSecondsToGo = 0;
}
// Delay this amount of time:
nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecondsToGo, (TaskFunc*)sendNext, this);
#else
sendNext(this);
#endif