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: trex7
Subject: Re: [lwip-users] flow of lwip as a stream client
Date: Thu, 1 Mar 2012 07:55:35 -0800 (PST)

Thanks for the reply. I'm indeed using a circular buffer to buffer the
incomming pbufs. My problem is that I don't how how to process the pbufs if
my circular buffer is full. That means that the decoder that consumes the
buffer is slower than the incomming pbufs. I dont want to stop the
application I just want to wait. The above code is not complete, sorry for
that, I just want to demonstrate that Im not sure what to do if the I cant
process the pbuf because I need to wait until I have enough space in the
circular buffer.
I appreciate your answer.


Robert-364 wrote:
> 
> 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.
>>
>>
> 
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/flow-of-lwip-as-a-stream-client-tp33420167p33422228.html
Sent from the lwip-users mailing list archive at Nabble.com.




reply via email to

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