lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] flow of lwip as a stream client


From: Robert
Subject: Re: [lwip-users] flow of lwip as a stream client
Date: Thu, 01 Mar 2012 16:33:18 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Hi,

This is what I think:

You cant just stop the communication only because your puffer is full, and since you're waiting for the "music" information you cant just ignore it. So I would program a ring buffer in them the incoming information overwrites it self the whole time.

http://en.wikipedia.org/wiki/Circular_buffer

and a nice tip for that don't do something like

counter++
if(counter == bufferSize ){
counter = 0;
}

you can use instead the modulo of the buffer size.

counter = (counter+1)  %  bufferSize

I hope this can help you.

Regards
Robert

Am 01.03.2012 16:09, schrieb trex7:
Hi,
I'm using raw lwip 1.3.2 as a client for an audio stream based application.
I'm a bit confuse how to handle the incomming pbufs when the audio buffer is
full and I have to wait until the audio buffer has enough space to
accomodate the pbuf.
My code looks something like this:

errt_t http_recv_cb(void *arg, struct tcp_pcb, struct pbuf*p, err_t err)
{
      if (connected&&  buffer_empty)
     {
        temp_pbuf = p;
        do_the_copy_to_buffer_task();//copy pbuf,  free the pbuf and call
tcp_recved()
        return OK;
      }
      else
      if (connected&&  !buffer_empty)  // buffer is full. Pbuf cannot be
process
     {
        // what should I do here?
        // should I free the bpuf here? or just ignore the bpuf and do
nothing here.
        // what should I return here?
     }
}

What should I do if the buffer is full and I cant process the incomming
pbufs? Should I call pbuf_free() or should I just ignore the incomming
pbufs? Which value should I return?

Thank you.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]