cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl don't write data directly (internal buffering?)

From: Eric Beuque <eric.beuque_at_gmail.com>
Date: Fri, 28 Sep 2012 23:16:16 +0200

Thank you for your help!

Yes i mean the write callback.

In fact, i add a sleep(1) in the function that process my frame.
I also develop a server application that generate an MJPEG stream (but i
got the same problem directly from an ip camera).

- The client connect to the server.
- The server works like a proxy, it got a frame from the camera IP, and
forward it to the client in the MJPEG stream. One thread received the
frames and replace the current frame, and one thread sent the current frame
to the client. So, i can count, the number of frame received, and the
number of frame sent in one second. For each frame, the server call a
waitForBytesWritten function to wait that the frame is sent to the client,
before sending another frame.
- What, i can see in the server is:
   t=0 => recv:25 FPS, sent 7FPS
   t=1 => recv:25 FPS, sent 1FPS
   t=2 => recv:25 FPS, sent 1FPS
   t=3 => recv:25 FPS, sent 1FPS
   t=4 => recv:25 FPS, sent 1FPS
   t=5 => recv:25 FPS, sent 1FPS
   t=6 => recv:25 FPS, sent 1FPS
- What i can see in the client is (because of the sleep(1)):
   t=0 => recv:1FPS
   t=1 => recv:1FPS
   t=2 => recv:1FPS
   t=3 => recv:1FPS

The problem is that the client t=4 don't receive the frame sent in t=4 in
the server part, but the fourth frame of t=0

I'm using Linux Mint LMDE with libcurl4-openssl-dev. I think the curl
version is 7.24, but i'm not able to be sure before monday.

Thank you for your help, i hope my english is good and you will be able to
understand me.

On Fri, Sep 28, 2012 at 10:41 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Thu, 27 Sep 2012, Eric Beuque wrote:
>
> The problem is that the write callback is not called as soon as the data
>> are received. I saw that sometime around 7 frames can be cached before i i
>> got the first write function call.
>>
>
> How exactly do you see this? And by "write function call", you mean a call
> to the write callback I presume?
>
> What libcurl version on what OS?
>
>
> Why libcurl is caching some data?
>>
>
> It doesn't. There's no such data cache or buffering going on, hence my
> questions above...
>
> --
>
> / daniel.haxx.se
> ------------------------------**------------------------------**-------
> List admin: http://cool.haxx.se/list/**listinfo/curl-library<http://cool.haxx.se/list/listinfo/curl-library>
> Etiquette: http://curl.haxx.se/mail/**etiquette.html<http://curl.haxx.se/mail/etiquette.html>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-28