[gst-devel] Linux audio is a mess? [was: JACK and GStreamer, from the horse's mouth]

Edgard Lima edgard.lima at indt.org.br
Thu Nov 30 17:10:58 CET 2006


Hi Paul,

ok, Im a bit late on this discussion (on vacation), but...

if you want to implement a pull based audiosink easily just look at 
sdlaudiosink (in gst-plugins-bad)

we don't "write" to the device, instead a callback named 
"fill_this_buffer" is called

the only thing you have to do is use a LOCK to protect producer and 
consumer, like this:

filesrc -> decoder -> sdlaudiosink

in closer look

"decoder" writes to a ringbuffer and will be blocked when it is full. 
(we are in push mode here and not problem at all)

from the sdlaudiosink what we do is to write data from this ringbuffer 
to a temporary buffer and them send to device when the callback is 
called, like this:

func_write_from_ring_buffer_to_temp_buffer() {
  lock(A)
  memcpy(temp_buffer, ring_buffer)
  unlock(B)
}

func_sdl_callback_fill_my_buffer(*buff) {
  lock(B)
  memcpy(buff, temp_buff);
  unlock(A);
}

if the return of "func_sdl_callback_fill_my_buffer" is too late, them 
silent will be played.

I dont know about JACK, so please comment this approach, does it work 
for you?

BR,
Edgard




















More information about the gstreamer-devel mailing list