alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Raymond Yau <superquad.vortex2@gmail.com>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: start_threshold and stream controls for PCM streams
Date: Wed, 14 Dec 2011 16:23:13 +0800	[thread overview]
Message-ID: <CAN8cciZUpiTGJCByyLTM5rHbc9SeaosFqwOK0nbkZgsf6Z7xVg@mail.gmail.com> (raw)
In-Reply-To: <s5hpqftu976.wl%tiwai@suse.de>

2011/12/12, Takashi Iwai <tiwai@suse.de>:
> At Fri, 9 Dec 2011 11:05:19 +0530,
> Nallasellan, Singaravelan wrote:
>>
>> Hi,
>>
>> Would like to know how start_threshold is expected to be used in
>> single_threaded audio player?
>>
>> I assume that in blocking implementation,  the write call will block
>> till the ring buffer becomes empty. Is it right?
>
> Not really.  It's not necessarily to be empty.  The condition is that
> the empty space becomes avail_min or more.
>
> But, this has nothing to do with start_threshold.  The start_threshold
> is the value to start the stream automatically.  When it's 1, the
> stream is started immediately when something is written.  When it's
> buffer_size, the stream is started when all data is filled in the
> buffer.
>
> And, the write-block behavior is irrelevant with start_threshold.
>

According to HDA specification

5.4.2 Link Sample Delivery Timing

HDA link is fixed at 48000Hz

For example, with a multiple of 4 (192 kHz sample rate), there must
be four sample blocks transmitted in every frame on the link

Does it mean that start threshold cannot be 1 for rate higher than 48000Hz ?

Any special requirement of the period size for rate higher than
48000Hz ? (.e.g mutliple of two for 96000Hz or multiple of 4 for
192000Hz)


44.1-kHz Delivery Timings
Since the link frame rate is fixed at 48 kHz, streams using a base
rate of 44.1 kHz must have samples transmitted on a cadence creating
the slightly lower aggregate transmission rate to match the slightly
lower rendering rate. For streams running at a sample rate of 44.1
kHz, instead of transmitting one sample block in each frame (as
happens for 48.0 kHz rate streams), there are occasional frames that
will not contain a sample generating the following cadence.
12-11-11-12-11-11-12-11-11-12-11-11-11- (repeat)

In this cadence, the dashes indicate frames that do not contain a
sample block. Therefore, there are 12 frames containing one sample
block each, followed by one frame with no sample block, followed by 11
frames with one sample block each, etc. Following the empty frame at
the end, the cadence repeats continuously generating exactly 147
sample blocks every 160 frames and avoiding any long-term drift
between sample delivery and rendering clock.

Does it mean that the first 12 samples of 44100Hz are transmitted at 48000Hz ?

      reply	other threads:[~2011-12-14  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09  5:35 start_threshold and stream controls for PCM streams Nallasellan, Singaravelan
2011-12-12 14:59 ` Takashi Iwai
2011-12-14  8:23   ` Raymond Yau [this message]

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=CAN8cciZUpiTGJCByyLTM5rHbc9SeaosFqwOK0nbkZgsf6Z7xVg@mail.gmail.com \
    --to=superquad.vortex2@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).