Skip to contentSkip to conversation

ALSA lib troubles with xine

DISCUSSION Markus Korber 4 participants 11 messages Sep 3, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:

,----

| audio_alsa_out: Audio Device name = default
| audio_alsa_out: Number of channels = 2
| Buffer size range from 4096 to 0            <- !!!
| Period size range from 0 to 0               <- !!!
| Buffer time size 44100
| To choose buffer_size = 4096
| To choose period_size = 512
| was set period_size = 0
| was set buffer_size = 4096
| audio_alsa_out:open pause_resume=1
| ACCESS:  RW_INTERLEAVED
| FORMAT:  S16_LE
| SUBFORMAT:  STD
| SAMPLE_BITS: 16
| FRAME_BITS: 32
| CHANNELS: 2
| RATE: 44100
| PERIOD_TIME: (46439 46440)
| PERIOD_SIZE: 2048
| PERIOD_BYTES: 8192
| PERIODS: 2
| BUFFER_TIME: (92879 92880)
| BUFFER_SIZE: 4096
| BUFFER_BYTES: 16384
| TICK_TIME: 10000
| audio_alsa_out: Unable to set swparams: Invalid argument

`----

So buffer and period sizes seem to be wrong and therefore I get no sound. (audio_alsa_out logging from [1].) Next I've tried to run speaker-test and the ouptut look good:

,----

| [root@(none) ~]# speaker-test 
| 
| speaker-test 1.0.15rc1
| 
| Playback device is default
| Stream parameters are 48000Hz, S16_LE, 1 channels
| Using 16 octaves of pink noise
| Rate set to 48000Hz (requested 48000Hz)
| Buffer size range from 4096 to 4096
| Period size range from 2048 to 2048
| Using max buffer size 4096
| Periods = 4
| was set period_size = 2048
| was set buffer_size = 4096
|  0 - Front Left

`----

Both applications are linked against the same ALSA library (dynamic or static linkage doesn't make a difference - speaker-test always works and xine always fails). And both applications use the same instructions (snd_pcm_hw_params_get_period_size_min/max()) AFAICS.

Any ideas what I could try next? Thanks.

Toolchain: buildroot based arm gcc 4.2.1 with uclibc 0.9.29. However, other applications (mplayer, aplay, alsaplayer) work as well, so I guess it's not toolchain related.

[1] http://xine.cvs.sourceforge.net/xine/xine-lib/src/audio_out/audio_alsa_out.c

Regards,
Markus Korber

#1 lore raw
Quoted 7 lines · Markus Korber

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:

| Period size range from 0 to 0               <- !!!
| To choose period_size = 512
| was set period_size = 0
| PERIOD_SIZE: 2048

A period size was set, but xine's code that tries to read the period size apparently doesn't work.

Please check the return values of the *_get_period_size* calls.

Quoted 1 line

Toolchain: buildroot based arm gcc 4.2.1 with uclibc 0.9.29.

Is it possible that xine-lib and alsa-lib were compiled with different compiler options, resulting in a different size of snd_pcm_uframes_t?

Regards,
Clemens

#2 lore raw

Thus spake Clemens Ladisch:

Quoted 9 lines
Quoted 7 lines · Markus Korber

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:

| Period size range from 0 to 0               <- !!!
| To choose period_size = 512
| was set period_size = 0
| PERIOD_SIZE: 2048
Quoted 4 lines

A period size was set, but xine's code that tries to read the period size apparently doesn't work.

Please check the return values of the *_get_period_size* calls.

All calls succeeded.

Regards,
Markus Korber

#3 lore raw
In reply to Markus Korber

Thus spake Markus Korber:

Quoted 6 lines

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:
[...]
So buffer and period sizes seem to be wrong and therefore I get no sound. (audio_alsa_out logging from [1].) Next I've tried to run speaker-test and the ouptut look good:

Sorry for the wrong information (Must have taken an older version of libasound). I've recompiled alsa-lib 1.0.15rc1 and alsa-utils 1.0.15rc1 and now speaker-test also fails:

,----

| [root@(none) ~]# speaker-test 
| 
| speaker-test 1.0.15rc1
| 
| Playback device is default
| Stream parameters are 48000Hz, S16_LE, 1 channels
| Using 16 octaves of pink noise
| Rate set to 48000Hz (requested 48000Hz)
| Buffer size range from 4096 to 1073748296
| Period size range from 0 to 0
| Using max buffer size 1073748296
| Periods = 4
| was set period_size = 0
| was set buffer_size = 4096
| Unable to set sw params for playback: Invalid argument
| Setting of swparams failed: Invalid argument

`----

Next I'll try to compile alsa-lib with '-O1' instead of '-Os' and then I'll revert back to 1.0.14a and give that version a try.

lg,
Markus Korber

#4 lore raw
Quoted 1 line · Markus Korber

| Buffer size range from 4096 to 1073748296

The second value is completely wrong.

Apparently, the kernel and the alsa-lib have been compiled with different sizes for the "long" data type.

HTH
Clemens

#5 lore raw
In reply to Markus Korber
Quoted 9 lines · Markus Korber

Thus spake Markus Korber:

Quoted 6 lines

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:
[...]
So buffer and period sizes seem to be wrong and therefore I get no sound. (audio_alsa_out logging from [1].) Next I've tried to run speaker-test and the ouptut look good:

Quoted 3 lines

Sorry for the wrong information (Must have taken an older version of libasound). I've recompiled alsa-lib 1.0.15rc1 and alsa-utils 1.0.15rc1 and now speaker-test also fails:

Try compile alsa-lib with '--with-versioned=no' and recompile (relink) speaker-test and other apps against this library.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

#6 lore raw

Thus spake Jaroslav Kysela:

Quoted 11 lines · Markus Korber
Quoted 9 lines

Thus spake Markus Korber:

Quoted 6 lines

I've got problems using ALSA (hg) and xine-lib (1.1.7). I'm trying to use fbxine for playback but ALSA debug logging gives me:
[...]
So buffer and period sizes seem to be wrong and therefore I get no sound. (audio_alsa_out logging from [1].) Next I've tried to run speaker-test and the ouptut look good:

Quoted 6 lines
Quoted 3 lines

Sorry for the wrong information (Must have taken an older version of libasound). I've recompiled alsa-lib 1.0.15rc1 and alsa-utils 1.0.15rc1 and now speaker-test also fails:

Try compile alsa-lib with '--with-versioned=no' and recompile (relink) speaker-test and other apps against this library.

Ok, speaker-test works again:

,----

| [root@(none) ~]# speaker-test 
| 
| speaker-test 1.0.15rc1
| 
| Playback device is default
| Stream parameters are 48000Hz, S16_LE, 1 channels
| Using 16 octaves of pink noise
| Rate set to 48000Hz (requested 48000Hz)
| Buffer size range from 4096 to 4096
| Period size range from 2048 to 2048
| Using max buffer size 4096
| Periods = 4
| was set period_size = 2048
| was set buffer_size = 4096
|  0 - Front Left

`----

And also fbxine now (kind of) works:

,----

| audio_alsa_out: Audio Device name = default
| audio_alsa_out: Number of channels = 2
| Buffer size range from 4096 to 4096
| Period size range from 2048 to 2048
| Buffer time size 44100
| To choose buffer_size = 4096
| To choose period_size = 512
| was set period_size = 2048
| was set buffer_size = 4096
| ACCESS:  RW_INTERLEAVED
| FORMAT:  S16_LE
| SUBFORMAT:  STD
| SAMPLE_BITS: 16
| FRAME_BITS: 32
| CHANNELS: 2
| RATE: 44100
| PERIOD_TIME: (46439 46440)
| PERIOD_SIZE: 2048
| PERIOD_BYTES: 8192
| PERIODS: 2
| BUFFER_TIME: (92879 92880)
| BUFFER_SIZE: 4096
| BUFFER_BYTES: 16384
| TICK_TIME: 10000
|   stream       : PLAYBACK
|   access       : RW_INTERLEAVED
|   format       : S16_LE
|   subformat    : STD
|   channels     : 2
|   rate         : 44100
|   exact rate   : 44100 (44100/1)
|   msbits       : 16
|   buffer_size  : 4096
|   period_size  : 2048
|   period_time  : 46439
|   tick_time    : 10000
|   tstamp_mode  : NONE
|   period_step  : 1
|   sleep_min    : 0
|   avail_min    : 2048
|   xfer_align   : 1
|   start_threshold  : 2048
|   stop_threshold   : 4096
|   silence_threshold: 0
|   silence_size : 0
|   boundary     : 1073741824
| start_mode: DATA
| xrun_mode: STOP
| tstamp_mode: NONE
| period_step: 1
| sleep_min: 0
| avail_min: 2048
| xfer_align: 1
| silence_threshold: 0
| silence_size: 0
| boundary: 1073741824
| output sample rate 44100
| xine_play

`----

However, the sound is stuttering a lot (I guess this is a xine-lib issue).

Nevertheless thanks Jaroslav and Clemens for your help!

Regards,
Markus Korber

#7 lore raw

At Mon, 03 Sep 2007 11:24:02 +0200,

Quoted 3 lines · Markus Korber

However, the sound is stuttering a lot (I guess this is a xine-lib issue).

Can you install older versions of ALSA-lib *manually* and check in which version the bug doesn't appear? Then we can pin-point the change.

thanks,

Takashi

#8 lore raw

Thus spake Takashi Iwai:

Quoted 9 lines

At Mon, 03 Sep 2007 11:24:02 +0200,

Quoted 2 lines · Markus Korber

However, the sound is stuttering a lot (I guess this is a xine-lib issue).

Can you install older versions of ALSA-lib *manually* and check in which version the bug doesn't appear? Then we can pin-point the change.

Ok, so I compiled alsa-lib, installed libasound.so, and recompiled the xine alsa output module against the appropriate alsa-lib:

1.0.13 : failed
1.0.14a : failed
1.0.15rc1 : failed

Any ideas?

Perhaps xine-lib doesn't work well if buffer_size = 2*period_size?

Regards,
Markus Korber

#9 lore raw

At Mon, 03 Sep 2007 16:52:03 +0200,

Quoted 16 lines · Markus Korber

Thus spake Takashi Iwai:

Quoted 9 lines

At Mon, 03 Sep 2007 11:24:02 +0200,

Quoted 2 lines · Markus Korber

However, the sound is stuttering a lot (I guess this is a xine-lib issue).

Can you install older versions of ALSA-lib *manually* and check in which version the bug doesn't appear? Then we can pin-point the change.

Ok, so I compiled alsa-lib, installed libasound.so, and recompiled the xine alsa output module against the appropriate alsa-lib:

Quoted 7 lines

1.0.13 : failed
1.0.14a : failed
1.0.15rc1 : failed

Any ideas?

Perhaps xine-lib doesn't work well if buffer_size = 2*period_size?

It depends on the setting.
Did it ever work with any version?

Takashi

#10 lore raw
Quoted 19 lines · Takashi Iwai

At Mon, 03 Sep 2007 16:52:03 +0200,

Quoted 17 lines · Markus Korber

Thus spake Takashi Iwai:

Quoted 8 lines

At Mon, 03 Sep 2007 11:24:02 +0200,

Quoted 2 lines · Markus Korber

However, the sound is stuttering a lot (I guess this is a xine-lib issue).

Can you install older versions of ALSA-lib *manually* and check in which version the bug doesn't appear? Then we can pin-point the change.

Ok, so I compiled alsa-lib, installed libasound.so, and recompiled the xine alsa output module against the appropriate alsa-lib:

1.0.13 : failed
1.0.14a : failed
1.0.15rc1 : failed

Quoted 6 lines
Quoted 3 lines

Any ideas?

Perhaps xine-lib doesn't work well if buffer_size = 2*period_size?

It depends on the setting.
Did it ever work with any version?

No. However, other applications work perfectly (mplayer, alsaplayer, aplay).

Regards,
Markus Korber