1. 程式人生 > >live555 調優

live555 調優

首先借鑑了網上的調優經驗,如下:

  1. 參考自:live555: The input frame data was too large for our buffer size 解決方法
// live/liveMedia/MultiFramedRTPsource.cpp
increaseReceiveBufferTo(env, RTPgs->socketNum(), 2000000);

// live/liveMedia/StreamParser.cpp
const int BANK_SIZE = 1920*1080 ;		//網上這裡有提到設定為 600,000

// live/liveMedia/MediaSink.cpp
unsigned OutPacketBuffer::maxSize = 600000;

  1. 參考自:live555 調優總結
// live/liveMedia/MultiFramedRTPSink.cpp
setPacketSizes((RTP_PAYLOAD_PREFERRED_SIZE), 8192);

// live/liveMedia/RTPInterface.cpp
increaseSendBufferTo(envir(), fGS->socketNum(), 512 * 1024);

// live/liveMedia/RTPInterface.cpp  此處需要先把下面兩行註釋掉
//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);

該參考資料中的排程優化未採用。


  1. Live555效能優化實踐中的兩種優化方法暫未採用。

// liveliveMedia/GenericMediaServer.cpp
increaseSendBufferTo(envir(), clientSocket, 512*1024);