diff --git a/SocketUtils.pas b/SocketUtils.pas index e46c5fe..1085cc9 100644 --- a/SocketUtils.pas +++ b/SocketUtils.pas @@ -117,6 +117,7 @@ TRTPVideoSink = class(TInterfacedObject, IRTPVideoSink) private fStats: IVideoStats; fServer: TIdUDPServer; + fLargestPacket: Int64; fClosed: Boolean; fWriteEvent: TEvent; @@ -410,7 +411,7 @@ constructor TRTPVideoSink.Create(const aPacketSize, aPacketCount: Integer; const fServer.DefaultPort := 0; fServer.ThreadedEvent := True; fServer.OnUDPRead := UDPRead; - fServer.Binding.SetSockOpt(Id_SOL_SOCKET, Id_SO_RCVBUF, 1024*1024); + fServer.Binding.SetSockOpt(Id_SOL_SOCKET, Id_SO_RCVBUF, 2*1024*1024); SetLength(fPackets, aPacketCount); for i := 0 to High(fPackets) do @@ -504,6 +505,15 @@ procedure TRTPVideoSink.UDPRead(AThread: TIdUDPListenerThread; if Length(AData) < 12 then Exit; + if AThread.Priority <> tpHigher then + AThread.Priority := tpHigher; + + if Length(AData) > fLargestPacket then + begin + fLargestPacket := Length(AData); + TLogger.LogFmt(cLogDefault, 'Largest packet: %d', [fLargestPacket]); + end; + lHeader := @AData[0]; Lock;