Audio Pipe with using the Sink Clock

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Audio Pipe with using the Sink Clock

Maik Scholz
Hi,
I like to build an audio pipeline with several internal app sources and a
single alsa sink.
The pipeline shall be clocked from the sink, with using the
alsasink.slave_mothod=2.
Unfortunately, the AudioClock is not selected by the pipeline.
Instead, the SystemClock is used.

How can I force the pipeline using the clock from the alsasink?

GStreamer Version: 1.10.5

>export GST_DEBUG=2,audioclock:5,pipeline:5,GST_CLOCK:3
>gst-launch-1.0 audiotestsrc freq=330 is-live=true do-timestamp=true !
alsasink provide-clock=true sync=true slave-method=2 can-activate-pull=true
async=true

0:00:00.008763468  7290      0x1832780 DEBUG             audioclock
gstaudioclock.c:69:gst_audio_clock_init:<GstAudioClock@0x18440d0> init
0:00:00.008899430  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:236:gst_pipeline_init:<GstPipeline@0x18461d0> set bus <bus1>
on pipeline
Setting pipeline to PAUSED ...
0:00:00.009070571  7290      0x1832780 DEBUG             audioclock
gstaudioclock.c:141:gst_audio_clock_reset:<GstAudioSinkClock> reset clock to
0:00:00.000000000, last 0:00:00.000000000, offset +0:00:00.000000000
0:00:00.017725425  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:305:reset_start_time:<pipeline0> reset start_time to 0
Pipeline is live and does not need PREROLL ...
0:00:00.018167469  7290      0x17d2630 WARN                    alsa
conf.c:4694:snd_config_expand: alsalib error: Unknown parameters {AES0 0x02
AES1 0x82 AES2 0x00 AES3 0x02}
0:00:00.018216937  7290      0x17d2630 WARN                    alsa
pcm.c:2239:snd_pcm_open_noupdate: alsalib error: Unknown PCM default:{AES0
0x02 AES1 0x82 AES2 0x00 AES3 0x02}
Setting pipeline to PLAYING ...
0:00:00.018238070  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:403:gst_pipeline_change_state:<pipeline0> selecting clock and
base_time
0:00:00.018244559  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:424:gst_pipeline_change_state:<pipeline0> Need to update
start_time
0:00:00.018247938  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:429:gst_pipeline_change_state:<pipeline0> Need to update
clock.
0:00:00.018288847  7290      0x1832780 DEBUG               pipeline
gstpipeline.c:469:gst_pipeline_change_state:<pipeline0>
start_time=0:00:00.000000000, now=20:55:58.945104958, base_time
20:55:58.945104958
New clock: GstSystemClock
0:00:00.018347844  7290      0x17d2630 DEBUG             audioclock
gstaudioclock.c:172:gst_audio_clock_get_internal_time:<GstAudioSinkClock>
result 0:00:00.000000000, last_time 0:00:00.000000000
0:00:00.018359345  7290      0x17d2630 DEBUG             audioclock
gstaudioclock.c:172:gst_audio_clock_get_internal_time:<GstAudioSinkClock>
result 0:00:00.000000000, last_time 0:00:00.000000000
0:00:00.022769254  7290      0x17d2630 DEBUG             audioclock
gstaudioclock.c:141:gst_audio_clock_reset:<GstAudioSinkClock> reset clock to
0:00:00.000000000, last 0:00:00.000000000, offset +0:00:00.000000000
Redistribute latency...
0:00:00.023340481  7290 0x7fc7f8003320 DEBUG               pipeline
gstpipeline.c:403:gst_pipeline_change_state:<pipeline0> selecting clock and
base_time
0:00:00.023351966  7290 0x7fc7f8003320 DEBUG               pipeline
gstpipeline.c:478:gst_pipeline_change_state:<pipeline0> NOT adjusting
base_time because we selected one before
0:00:00.042286706  7290      0x17d2630 DEBUG             audioclock
gstaudioclock.c:202:gst_audio_clock_get_time:<GstAudioSinkClock> result
0:00:00.000000000, last_time 0:00:00.000000000

... from here, "gst_audio_clock" is not called anymore.






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Audio Pipe with using the Sink Clock (need help)

Maik Scholz
Hi again,
I just gave that issue another try.

I have a simple audio pipeline, audiotestsrc => alsasink.
For my real application, I have the requirement, that the sink element clock
is used as pipeline clock.
But I see, that the system clock is used instead.
This cause a clock skew and a buffer over-/underrun in my real application.

/*How can i make sure, that the sink clock is used?*/

>export
GST_DEBUG=2,audioclock:9,pipeline:5,GST_CLOCK:9,audiobasesink:9,ringbuffer:9,alsa:9

>*gst-launch-1.0 audiotestsrc freq=330 is-live=true do-timestamp=true !
alsasink device=hw:0,0 provide-clock=true sync=true slave-method=2
can-activate-pull=true async=true* 2> /tmp/gst.log

*gst.log:*


*For my understanding, at this point in time, the audio sink deny's
providing a clock because the ringbuffer is not ready.*



*Now the system clock is used!*





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Audio Pipe with using the Sink Clock (need help)

Maik Scholz
My GST_DEBUG log was removed from the mailing daemon.

*gst.log:*

    audioclock
gstaudioclock.c:70:gst_audio_clock_init:<GstAudioClock@0x1912100> init
     GST_CLOCK gstsystemclock.c:270:gst_system_clock_set_property:
clock-type set to 2
          alsa gstalsasink.c:257:gst_alsasink_init:<GstAlsaSink@0x19117d0>
initializing alsasink
      pipeline gstpipeline.c:237:gst_pipeline_init:<GstPipeline@0x1915070>
set bus <bus1> on pipeline
     GST_CLOCK gstelement.c:489:gst_element_set_base_time:<audiotestsrc0>
set base_time=0:00:00.000000000, old 0:00:00.000000000
     GST_CLOCK gstelement.c:551:gst_element_set_start_time:<audiotestsrc0>
set start_time=0:00:00.000000000, old 0:00:00.000000000
     GST_CLOCK gstelement.c:429:gst_element_set_clock:<audiotestsrc0>
setting clock (nil)
     GST_CLOCK gstelement.c:489:gst_element_set_base_time:<alsasink0> set
base_time=0:00:00.000000000, old 0:00:00.000000000
     GST_CLOCK gstelement.c:551:gst_element_set_start_time:<alsasink0> set
start_time=0:00:00.000000000, old 0:00:00.000000000
     GST_CLOCK gstelement.c:429:gst_element_set_clock:<alsasink0> setting
clock (nil)
          alsa gstalsasink.c:292:gst_alsasink_getcaps:<alsasink0> device not
open, using template caps
          alsa gstalsasink.c:292:gst_alsasink_getcaps:<alsasink0> device not
open, using template caps
    audioclock gstaudioclock.c:144:gst_audio_clock_reset:<GstAudioSinkClock>
reset clock to 0:00:00.000000000, last 0:00:00.000000000, offset
+0:00:00.000000000
    ringbuffer
gstaudioringbuffer.c:453:gst_audio_ring_buffer_open_device:<audiosinkringbuffer0>
opening device
          alsa gstalsasink.c:849:gst_alsasink_open:<alsasink0> Opened device
hw:0,0
    ringbuffer
gstaudioringbuffer.c:471:gst_audio_ring_buffer_open_device:<audiosinkringbuffer0>
opened device
      pipeline gstpipeline.c:306:reset_start_time:<pipeline0> reset
start_time to 0
    ringbuffer
gstaudioringbuffer.c:1991:gst_audio_ring_buffer_may_start:<audiosinkringbuffer0>
may start: 0
          alsa gstalsa.c:191:gst_alsa_detect_formats:<alsasink0> skipping
non-raw format
          alsa gstalsa.c:191:gst_alsa_detect_formats:<alsasink0> skipping
non-raw format
          alsa gstalsa.c:191:gst_alsa_detect_formats:<alsasink0> skipping
non-raw format
          alsa gstalsa.c:191:gst_alsa_detect_formats:<alsasink0> skipping
non-raw format
          alsa gstalsa.c:30:gst_alsa_detect_rates:<alsasink0> probing sample
rates ...
          alsa gstalsa.c:49:gst_alsa_detect_rates:<alsasink0> Min. rate =
44100 (44100)
          alsa gstalsa.c:50:gst_alsa_detect_rates:<alsasink0> Max. rate =
48000 (48000)
          alsa gstalsa.c:348:gst_alsa_detect_channels:<alsasink0> probing
channels ...
          alsa gstalsa.c:392:gst_alsa_detect_channels:<alsasink0> Min.
channels = 2 (2)
          alsa gstalsa.c:393:gst_alsa_detect_channels:<alsasink0> Max.
channels = 2 (2)
      pipeline gstpipeline.c:412:gst_pipeline_change_state:<pipeline0>
selecting clock and base_time
      pipeline gstpipeline.c:433:gst_pipeline_change_state:<pipeline0> Need
to update start_time
          alsa gstalsa.c:472:gst_alsa_open_iec958_pcm:<alsasink0> Generated
device string "hw:0,0:{AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02}"
      pipeline gstpipeline.c:438:gst_pipeline_change_state:<pipeline0> Need
to update clock.
          alsa conf.c:4913:parse_args: alsalib error: Parameter DEV must be
an integer
          alsa conf.c:5018:snd_config_expand: alsalib error: Parse arguments
error: 0,0:{AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02} Invalid argument
          alsa pcm.c:2565:snd_pcm_open_noupdate: alsalib error: Unknown PCM
hw:0,0:{AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02}
          alsa gstalsa.c:478:gst_alsa_open_iec958_pcm:<alsasink0> failed
opening IEC958 device: Invalid argument
 audiobasesink
gstaudiobasesink.c:362:gst_audio_base_sink_provide_clock:<alsasink0>
ringbuffer not acquired

*For my understanding, at this point in time, the audio sink deny's
providing a clock because the ringbuffer is not ready.*

          alsa gstalsasink.c:332:gst_alsasink_getcaps:<alsasink0> returning
caps audio/x-raw, format=(string)S16LE, layout=(string)interleaved,
rate=(int)[ 44100, 48000 ], channels=(int)2,
channel-mask=(bitmask)0x0000000000000003
     GST_CLOCK gstsystemclock.c:353:gst_system_clock_obtain: creating new
static system clock
     GST_CLOCK gstpipeline.c:732:gst_pipeline_provide_clock_func: pipeline
obtained system clock: 0x19270f0 (GstSystemClock)
     GST_CLOCK gstclock.c:1046:gst_clock_get_internal_time:<GstSystemClock>
internal time 0:51:32.592473507
     GST_CLOCK gstclock.c:1091:gst_clock_get_time:<GstSystemClock> adjusted
time 0:51:32.592473507
     GST_CLOCK gstelement.c:429:gst_element_set_clock:<pipeline0> setting
clock 0x19270f0
     GST_CLOCK gstelement.c:429:gst_element_set_clock:<alsasink0> setting
clock 0x19270f0
          alsa gstalsasink.c:303:gst_alsasink_getcaps:<alsasink0> Returning
cached caps audio/x-raw, format=(string)S16LE, layout=(string)interleaved,
rate=(int)[ 44100, 48000 ], channels=(int)2,
channel-mask=(bitmask)0x0000000000000003 with filter audio/x-raw,
format=(string)S16LE, layout=(string)interleaved, rate=(int)44100,
channels=(int)2, channel-mask=(bitmask)0x0000000000000003 applied:
audio/x-raw, format=(string)S16LE, layout=(string)interleaved,
rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
     GST_CLOCK gstelement.c:429:gst_element_set_clock:<audiotestsrc0>
setting clock 0x19270f0

*Now the system clock is used!*



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel