discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] gri_ringbuffer.{h,cc}


From: Stephane Fillod
Subject: Re: [Discuss-gnuradio] gri_ringbuffer.{h,cc}
Date: Mon, 13 Mar 2006 08:18:49 +0100
User-agent: Mutt/1.5.11

On Sun, Mar 12, 2006 at 06:03:39PM -0800, Eric Blossom wrote:
> On Sun, Mar 12, 2006 at 10:20:16PM +0100, Stephane Fillod wrote:
> > 
> > - against gnuradio-core: ot_gri_ringbuffer.patch
> >     * src/lib/general/gri_ringbuffer.{cc,h},
> >       src/lib/general/Makefile.am: new lockless ringbuffer (single
> >           reader/single writer) taken from JACK software (GPL).
> 
> Bob and Frank,
> 
> Didn't the JACK ringbuffer code cause you problems when pushing "part
> of a float" into it.  I.e., there was room for 3 bytes, but not all
> four.  If this is true, how did you fix it?  Specialize for only
> floats?  "Yet another ringbuffer implementation" that doesn't have
> the problem?  I can't see an occasion when we'd need anything other
> than floats.

>Answering my own question, I guess as long as you use write_space and
>round down prior to writing, everything should work fine.

Yes, this is exactly what is done in gr-audio-{jack,portaudio}.
Look at the lines like this:

    write_space -= write_space%buffer_size_bytes;
    write_size = std::min(write_space, (unsigned int)work_size);

The ringbuffer max usable size is an exponent of two, minus one. Hence you 
end up pushing partial objects into it if no care is taken when the 
ringbuffer is full. 
In the end, no need to specialize it.

-- 
Stephane




reply via email to

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