follow up fix related to 933b05c331 (ticket #263 uninitialized dir variable): fix the three other places where dir parameter wasn't set prior to entry to a snd_pcm_*_get_* function. There is some ambiguity about (a) whether this is intentional (i.e. use the rounding dir returned by previous *_get_* call, the PA source code does not indicate), and (b) whether it is meaningful (i.e. whether *_get_* functions actually use the value upon input -- the ALSA docs are not clear. regarding (a): I don't think it's intentional, i think it was just oversight. In any case thr risk is low: the underlying values of period_size, periods_max, periods_min, are all integer and should not be rounded, get_rate_min/get_rate_max are used only for debug reporting (I've set them to 0,0 for a minimal change from the current code, but -1,1 makes more sense).
This commit is contained in:
parent
c5d2c51bd6
commit
f269bf93e6
1 changed files with 4 additions and 0 deletions
|
|
@ -323,8 +323,10 @@ int _PA_LOCAL_IMPL(snd_pcm_hw_params_get_buffer_size_max) (const snd_pcm_hw_para
|
|||
snd_pcm_uframes_t pmax = 0;
|
||||
unsigned int pcnt = 0;
|
||||
|
||||
dir = 0;
|
||||
if(( ret = _PA_LOCAL_IMPL(snd_pcm_hw_params_get_period_size_max)(params, &pmax, &dir) ) < 0 )
|
||||
return ret;
|
||||
dir = 0;
|
||||
if(( ret = _PA_LOCAL_IMPL(snd_pcm_hw_params_get_periods_max)(params, &pcnt, &dir) ) < 0 )
|
||||
return ret;
|
||||
|
||||
|
|
@ -2324,6 +2326,7 @@ static PaError PaAlsaStreamComponent_DetermineFramesPerBuffer( PaAlsaStreamCompo
|
|||
/* It may be that the device only supports 2 periods for instance */
|
||||
dir = 0;
|
||||
ENSURE_( alsa_snd_pcm_hw_params_get_periods_min( hwParams, &minPeriods, &dir ), paUnanticipatedHostError );
|
||||
dir = 0;
|
||||
ENSURE_( alsa_snd_pcm_hw_params_get_periods_max( hwParams, &maxPeriods, &dir ), paUnanticipatedHostError );
|
||||
assert( maxPeriods > 1 );
|
||||
|
||||
|
|
@ -3209,6 +3212,7 @@ error:
|
|||
unsigned int _min = 0, _max = 0;
|
||||
int _dir = 0;
|
||||
ENSURE_( alsa_snd_pcm_hw_params_get_rate_min( hwParams, &_min, &_dir ), paUnanticipatedHostError );
|
||||
_dir = 0;
|
||||
ENSURE_( alsa_snd_pcm_hw_params_get_rate_max( hwParams, &_max, &_dir ), paUnanticipatedHostError );
|
||||
PA_DEBUG(( "%s: SR min = %u, max = %u, req = %u\n", __FUNCTION__, _min, _max, reqRate ));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue