Hello! Dear Developers, I am from HNU University (Changsha, China), a fresh man in ALSA sound developing. Recently, a alsa bug( snd_pcm_hw_params_get_buffer_time snd_pcm_hw_params_get_period_time ) occured to me which made me confused! Firstly (Step 1) I set hardware params normally(rate: 44100, channel: 2, format: S16_LE, access: raw_interleaved, period size: not set, buffer size: not set), It was OK. Laterly (Step 2) I get hw_params and print it, it was not surprising that they were the same as what I set (buffer_time == period_time * 1024, buffer_size == period_size * 1024). But! In another code ( Add Step 3)I used snd_pcm_format_name((snd_pcm_format_t)val), snd_pcm_format_description( (snd_pcm_format_t)val) to display the format information, It got wrong buffer size(buffer_time == period_time, buffer_size == period_size * 1024 ). the Attachments are code pcm_setting.cpp(With Step 1, 2), pcm_open_seeting.cpp(With Step 1, 2, 3). My alsa-lib version is about 1.1.0 .
pcm_setting.cpp running result: get rate: 44100 get channles: 1 period time: 46439 buffer time is 47554467 period size: 2048 frames buffer size default: 2097152 frames periods per buffer = 1024 frames
pcm_open_setting running result: PCM handle name = 'default' PCM state = PREPARED access type = RW_INTERLEAVED format(length: 2) = 'S16_LE' (Signed 16 bit Little Endian) channels = 1 rate = 44100 bps period time = 46438 us buffer time = 46438 us period size = 2048 frames buffer size = 2097152 frames periods per buffer = 1024 frames