I am using TIdHttp (from Indy components) for connecting to a camera that supports Sony Remote Api. The camera sends live view stream to an http connection as a response of an HTTP GET command. I wrote a TStream subclass and used it as a streaming class. Here is my code for connecting to live stream:
liveStream := TLiveStream.Create;
IdHttp1.Get('http://192.168.122.1:8080/liveview/liveviewstream', liveStream);
Definition of TLiveStream class is as follows:
TLiveStream = class(TStream)
public
constructor Create;
function Read(var vBuffer; aCount: Longint): Longint; override;
function Write(const aBuffer; aCount: Longint): Longint; override;
function Seek(const aOffset: Int64; aOrigin: TSeekOrigin): Int64; override;
end;
Program is connecting to live stream successfully and starts receiving live view from camera. But it randomly stops receiving anything from camera for five seconds (program is idle and does not freeze). I replaced TIdHttp with THttpCli from ICS but the problem does not resolve.
Any help would be greatly appreciated!
Edit:
I used curl tool to find out whether the problem is within my program, but the problem remained. I sniff packets transmitted between camera and PC, here is the screenshot of the delayed time: