All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo da Silva Serra <gustavo.serra@tet.com.br>
To: anuj aggarwal <anuj.aggarwal@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Application hangs with different period sizes
Date: Thu, 03 Jul 2008 10:00:51 -0300	[thread overview]
Message-ID: <486CCD83.4040408@tet.com.br> (raw)
In-Reply-To: <2ee9e08d0807030554t259c3b79x9023d901408a36e7@mail.gmail.com>

I think that snd_pcm_hw_params_set_period_size_near() will not return an 
error, but you must check the "val" parameter, is it returning the same 
value that you passed?

"Some periods are not supported" means that some cards may not support 
periods that aren't power of two. I am not sure, since I am new to ALSA 
and I am working most with aloop.

anuj aggarwal escreveu:
> I am doing the same. I used snd_pcm_hw_params_set_period_size_near() 
> to set the period size and checked the return value also; it was not 
> an error.
>
> I have one more question. When you say 'Some periods are not 
> supported', what does that mean? What are the constraints which make 
> some periods not-supported by the audio codec driver?
>
> On Thu, Jul 3, 2008 at 5:11 PM, Gustavo da Silva Serra 
> <gustavo.serra@tet.com.br <mailto:gustavo.serra@tet.com.br>> wrote:
>
>     Do you check the result of the function that sets the period size?
>     Some periods are not supported and you can't assume that they are
>     valid and proceed in your application. Use
>     snd_pcm_hw_params_set_period_time_near to see what is the nearest
>     possible value for period.
>     <http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___h_w___params.html#gf5e53bcb748185a4da3b8538720a5792>
>
>     anuj aggarwal escreveu:
>
>         My audio driver supports buffer sizes from 128 to 32768 and
>         period sizes
>         from 8 to 2048. I am trying to set the period size as 1030
>         (just a random
>         number between 8 & 2048, but not multiple of 2^n) and buffer
>         size as
>         16*buffer_size (i.e. 16480). The output is as follows:
>
>         Buffer size range from 128 to 32768
>         Period size range from 8 to 2048
>         Request period size 1030 and got 1030
>         Plug PCM: Hardware PCM card 0 'TWL4030' device 0 subdevice 0
>         Its setup is:
>          stream       : PLAYBACK
>          access       : RW_INTERLEAVED
>          format       : S16_LE
>          subformat    : STD
>          channels     : 2
>          rate         : 44100
>          exact rate   : 44100 (44100/1)
>          msbits       : 16
>          buffer_size  : 16480
>          period_size  : 1030
>          period_time  : 23356
>          tstamp_mode  : NONE
>          period_step  : 1
>          avail_min    : 1030
>          start_threshold  : 16480
>          stop_threshold   : 16480
>          silence_threshold: 0
>          silence_size : 0
>          boundary     : 1080033280
>
>         The problem with this setup is the application just hangs
>         without playing
>         anything. If I use period size as 2048, the app plays the song
>         but clips the
>         last part of it. If I use 1024/512, it works fine.
>
>         I have tried alsa lib version 1.0.15 & 1.0.16 but the problem
>         persists. Is
>         there anything wrong with my app or audio driver?
>
>         Please help.
>
>         Thanks in advance,
>         Anuj Aggarwal
>         _______________________________________________
>         Alsa-devel mailing list
>         Alsa-devel@alsa-project.org <mailto:Alsa-devel@alsa-project.org>
>         http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
>         __________ NOD32 3238 (20080703) Information __________
>
>         This message was checked by NOD32 antivirus system.
>         http://www.eset.com
>
>
>
>          
>
>
>
>
>
> -- 
> Best Regards,
> Anuj Aggarwal 

  reply	other threads:[~2008-07-03 13:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03  7:19 Application hangs with different period sizes anuj aggarwal
2008-07-03 11:41 ` Gustavo da Silva Serra
2008-07-03 12:54   ` anuj aggarwal
2008-07-03 13:00     ` Gustavo da Silva Serra [this message]
2008-07-03 13:41       ` anuj aggarwal
2008-07-03 15:31         ` Gustavo da Silva Serra
2008-08-07 10:18           ` anuj aggarwal
2008-08-08  6:18             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486CCD83.4040408@tet.com.br \
    --to=gustavo.serra@tet.com.br \
    --cc=alsa-devel@alsa-project.org \
    --cc=anuj.aggarwal@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.