alsasink read silence data from audioringbuffer

yang wang ohwangyang at 163.com
Mon Aug 13 08:06:29 UTC 2018


Hi all,

These days i am focusing on an noise error: at the beginning of my pipeline
user will heard some noise, and after a while, the noise can disappear.  

during the investigation i found some information. The error is caused by
silence data read from gstringbuffer . In my device, the alsa side has a
buffer about 400ms, so the snd_pcm_writei will be fast enough at the the
beginning of the pipeline, while the source will still produce a buffer at
about 10ms.  so when we set the sync property of alsasink to false will
cause alsasink read silence data from gstringbuffer, just like:
prepare read segment 9-> finish reading->default_commit segment 9-> clear
segment 9.
or
preapare read segment 10-> finish reading-> clear segment 10-> preapare read
segment 11-> finish reading-> clear segment 11 -> default_commit segment
12-> preapare read segment 12-> finish reading-> clear segment 12

gst_audio_ring_buffer_prepare_read has no lock, and it will always return a
segment in gstringbuffer, no matter whether another thread is writing data
to gstringbuffer.

my pipeline is like:
alsasrc device=plughw:2,0 provide-clock=FALSE ! capsfilter
caps="audio/x-raw, endianness=1234, signed=TRUE, width=16, depth=16,
rate=44100, channels=2" ! queue ! volume mute=FALSE ! audioresample !
alsasink buffer-time=800000 provide-clock=TRUE can-activate-pull=TRUE
slave-method=2 drift-tolerance=9223372036854775807
discont-wait=18446744073709551614 device=ipod sync=FALSE
gstreamer version:1.12.2
OS: linux

this bug can be fixed with setting sync to TRUE. But setting sync to false
will cause other problems(noise come out after a long time test, from google
setting sync to true sometimes cause pipeline no sound).

my question is:
1. how to avoid reading silence data from gstringbuffer, that is how to fix
the error except setting sync property to true?
2. gst_audio_ring_buffer_prepare_read invoked in function
audioringbuffer_thread in gstaudiosink has no lock,  how to make read/write
sync with each other.

I have attached one log. gst.log
<http://gstreamer-devel.966125.n4.nabble.com/file/t378486/gst.log>  




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list