Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Timo Wischer <twischer@de.adit-jv.com>
To: Takashi Sakamoto <mocchi.sakamoto113@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH - Intervals v2 1/1] interval: Interpret (x x+1] correctly and return x+1
Date: Thu, 18 Oct 2018 17:16:50 +0200	[thread overview]
Message-ID: <47486a8d-63f8-9b03-322a-e126ee0939fe@de.adit-jv.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1810182339530.3374@laptop>

On 10/18/18 16:45, Takashi Sakamoto wrote:
> Hi,
>
> On Thu, 18 Oct 2018, Timo Wischer wrote:
>> The reason for this fix was an issue where an interval of (x x+1] is 
>> interpreted as not a single value.
>> Before the change in snd_interval_single() the following intervals 
>> were interpreted as a single value:
>>
>> * (x x) -> required for rounding issues e.g. 32ms * 22,05 kHz = 705,6
>>   frames => (705 706)
>> * (x x]
>> * [x x)
>> * [x x]
>> * (x x+1)
>> * [x x+1)
>>
>> With this change (x x+1] will also be interpreted as a single value 
>> (which looks reasonable for me).
>> But the interval [x x+1] is still not interpreted as a single value 
>> (which also sounds right for me)
>>
>> Before the change in snd_interval_value() for all intervals x was 
>> returned.
>> With this change only in case (x x+1] x+1 will be returned. All other 
>> intervals are not changed.
>>
>> Therefore this is a minimal change which solves issues. I have 
>> already at least two use cases which
>> are failing without this fix. (Somehow simple use cases with 
>> rate->dmix->hw where the hw truncates
>> the default period_time of 125ms and fails with EINVAL on 
>> snd_pcm_set_period_near()).
>> Therefore I would expect that these issues will be seen soon by other 
>> users.
>>
>> If there is a use case which breaks in future due to the right 
>> interpretation of (x x+1] I think we should try
>> to find the root cause why this (x x+1] interval has to be 
>> interpreted wrongly to get the use case to work.
>
> 'struct snd_interval' has 'integer' flag. When this flag is off,
> '(x, x + 1]' brings no single unique value. The inline function
> 'snd_interval_single()' should handle this case correctly.
Okay. Thanks for the hint. I think than I does not yet got the meaning 
of the integer flag correctly. My expectation was that the interval is 
interpreted as a real number interval in case integer is not set and 
interpreted as a natural number interval. Therefore in case of integer 
is not set the interval includes all real numbers which are >x and <=x+1 
e.g. the interval (1 2] includes 1.89 and 2.

In case of integer flag is set I would expect the same rule >x and <=x+1 
e.g. (1 2] only 2 is included because this is the only natural number 
which is >1 and <=2.

Please correct me if I am wrong.

>
>
> Thanks
>
> Takashi Sakamoto (@airport)
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2018-10-18 15:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 11:33 [PATCH - Intervals v2 1/1] interval: Interpret (x x+1] correctly and return x+1 twischer
2018-10-18 12:02 ` Takashi Iwai
2018-10-18 12:28   ` Timo Wischer
2018-10-18 13:19     ` Takashi Iwai
2018-10-18 14:31       ` Timo Wischer
2018-10-18 14:45         ` Takashi Sakamoto
2018-10-18 15:16           ` Timo Wischer [this message]
2018-10-18 14:58         ` Takashi Iwai
2018-10-18 15:55           ` Timo Wischer
2018-10-18 18:57             ` Takashi Iwai
2018-10-22  7:19               ` Timo Wischer
2018-10-24  7:06                 ` Takashi Iwai
2018-10-24  7:44                   ` Timo Wischer
2018-10-24  7:48                     ` Takashi Iwai
2018-10-24  8:05                       ` Timo Wischer
2018-10-24 10:15                         ` Jaroslav Kysela

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=47486a8d-63f8-9b03-322a-e126ee0939fe@de.adit-jv.com \
    --to=twischer@de.adit-jv.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=mocchi.sakamoto113@gmail.com \
    --cc=tiwai@suse.de \
    /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