以640*480为例
live555/liveMedia/StreamParsercpp.cpp:
define BANK_SIZE 15000 改为:
define BANK_SIZE 3000000
live555/mediaServer/DynamicRTSPServer.cpp:
OutPacketBuffer::maxSize一共有4处全部改为
OutPacketBuffer::maxSize = 2000000;
live555/liveMedia/MediaSink.cpp:
unsigned OutPacketBuffer::maxSize = 60000;改为
unsigned OutPacketBuffer::maxSize = 2000000;
继承framedSource之后
unsigned H264FramedLiveSource::maxFrameSize() const
{
return 1024*180;
}
MediaSink.cpp
114行:
unsigned OutPacketBuffer::maxSize = 30000;
StreamParser.cp
宏定义:
#define BANK_SIZE 150000,改为2400000;
MultiFramedRTPSink.cpp
47行:
setPacketSizes(1000, 8192);
RTPInterface.cpp
129行:
increaseSendBufferTo(envir(), fGS->socketNum(), 512*1024);
//数据累积发送,不再单独发送
//注释掉332行,修改为以下:
//if (!sendDataOverTCP(socketNum, framingHeader, 4, False)) break;
//if (!sendDataOverTCP(socketNum, packet, packetSize, True)) break;
struct iovec iov[2];
iov[0].iov_base = framingHeader;
iov[0].iov_len = 4;
iov[1].iov_base = packet;
iov[1].iov_len = packetSize;
writev(socketNum, iov, 2);
帧率改为30,直播延迟就由5延迟慢慢减少到1秒不到,不知道为什么会这样,如果是24帧,直播延迟会越来越大
encoder->x264_parameter->i_fps_num = 30;//码率分子
encoder->x264_parameter->i_fps_den = 1;//码率分母
原文:https://www.cnblogs.com/leocc325/p/13686038.html