[Bug 692953] alsasink does not synchronise properly with a live streaming source, yet (timing skew)

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Fri May 23 10:57:35 PDT 2014


https://bugzilla.gnome.org/show_bug.cgi?id=692953
  GStreamer | gst-plugins-base | 1.0.10

Rémi Lefèvre <remi.lefevre> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |remi.lefevre at parrot.com

--- Comment #210 from Rémi Lefèvre <remi.lefevre at parrot.com> 2014-05-23 17:57:25 UTC ---
Hi, 

I think I encouter a related issue with alsasink that could have the same root
cause. My pipeline play broadcasted TV in real time (so a live source and video
+ audio sinks with sync=true). 

The problem occurs sometimes as soon as the pipeline is started, but always
after an xrun recovery. When this happens, I get no sound at all or incorrect
sound (partial sample buffers). Also when the issue occurs, I then get xrun
repeatedly. Audio may come back after a while (several minutes).

I can very easily reproduce the issue, so investigation is facilitated.
Also the problem never occurs with sync=false on the alsasink, but of course
audio is then unsynchronized.

I have narrowed the issue to alsasink as input buffers are filled with data but
output buffers are filled with zero when the problem leads to silence.

I think the problem may come from GstAudioSinkRingBuffer and the following
debug logs seem to illustrate an issue:

When no problem occurs, we can see that a segment prepare read (there are two
audio segments, 0 and 1) is always followed by a write then a segment clear:

D ringbuffer  (kraken/audio_queue:src)         :
GstAudioSinkRingBuffer:acquired device
D ringbuffer  (kraken/audio_queue:src)         :
GstAudioSinkRingBuffer:activate device
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: buffer
time: 42666 usec
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: latency
time: 21333 usec
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: total
segments: 2
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: latency
segments: 3
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: segment
size: 8192 bytes = 1024 samples
D ringbuffer  (kraken/audio_queue:src)         : acquire ringbuffer: buffer
size: 16384 bytes = 2048 samples
...
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 4) @0x72953618
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:80c32308...18b35a07
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 4, write to 5-0, diff 1, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x72955618 seg 1, sps 1024, off 0, avail 4024
D ringbuffer  (kraken/audio_queue:src)         : copy 4024 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
1536 : 1536
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 4, write to 5-4024, diff 1, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x72955618 seg 1, sps 1024, off 4024, avail 4168
D ringbuffer  (kraken/audio_queue:src)         : copy 4168 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 4, write to 6-0, diff 2, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         :
GstAudioSinkRingBuffer:waiting..
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 0 @0x72953618
D ringbuffer  (kraken/audiosink-ringb)         : GstAudioSinkRingBuffer:signal
waiter
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 1
(real 5) @0x72955618
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:408dee07...500c35fc
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 5, write to 6-0, diff 1, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x72953618 seg 0, sps 1024, off 0, avail 8120
D ringbuffer  (kraken/audio_queue:src)         : copy 8120 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
1536 : 1536
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 5, write to 6-8120, diff 1, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x72953618 seg 0, sps 1024, off 8120, avail 72
D ringbuffer  (kraken/audio_queue:src)         : copy 72 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 5, write to 7-0, diff 2, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         :
GstAudioSinkRingBuffer:waiting..
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 1 @0x72955618
D ringbuffer  (kraken/audiosink-ringb)         : GstAudioSinkRingBuffer:signal
waiter
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 6) @0x72953618
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:f4f6dbfc...22130cff


The logs GstAlsaSink:408dee07...500c35fc are custom logs that display the first
and last 4 bytes of the data written by gst_alsasink_write().


When the problem occurs, we see several consecutive segments prepare reads
followed by clear before any write occur, then consecutive write occur with
null data, as the segments have been cleared just before:

D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 11358) @0x745ce898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 0 @0x745ce898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 1
(real 11359) @0x745d0898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 1 @0x745d0898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 11360) @0x745ce898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 0 @0x745ce898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 1
(real 11361) @0x745d0898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 1 @0x745d0898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 11362) @0x745ce898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 0 @0x745ce898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 1
(real 11363) @0x745d0898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 1 @0x745d0898
D ringbuffer  (kraken/audiosink-ringb)         : prepare read from segment 0
(real 11364) @0x745ce898
W alsa        (kraken/audiosink-ringb)         :
GstAlsaSink:00000000...00000000
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
1536 : 1536
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 11364, write to 11348-1088, diff -16, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x745ce898 seg 0, sps 1024, off 1088, avail 7104
D ringbuffer  (kraken/audio_queue:src)         : copy 7104 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 11364, write to 11349-0, diff -15, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x745d0898 seg 1, sps 1024, off 0, avail 5184
D ringbuffer  (kraken/audio_queue:src)         : copy 5184 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
1536 : 1536
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 11364, write to 11349-5184, diff -15, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x745d0898 seg 1, sps 1024, off 5184, avail 3008
D ringbuffer  (kraken/audio_queue:src)         : copy 3008 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 11364, write to 11350-0, diff -14, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x745ce898 seg 0, sps 1024, off 0, avail 8192
D ringbuffer  (kraken/audio_queue:src)         : copy 8192 bytes
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:pointer
at 11364, write to 11351-0, diff -13, segtotal 2, segsize 8192, base 0
D ringbuffer  (kraken/audio_queue:src)         : GstAudioSinkRingBuffer:write
@0x745d0898 seg 1, sps 1024, off 0, avail 1088
D ringbuffer  (kraken/audio_queue:src)         : copy 1088 bytes
D ringbuffer  (kraken/audiosink-ringb)         : clear segment 0 @0x745ce898


You can notice that from GstAlsaSink:00000000...00000000 logs that
gst_alsasink_write() is called with null data.


Do you think this could be the same issue and what I could do to investigate
further the problem ?

Regards,
Rémi

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list