Loading include/sound/pcm.h +2 −0 Original line number Diff line number Diff line Loading @@ -922,6 +922,8 @@ snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames); extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, Loading sound/core/pcm_misc.c +4 −9 Original line number Diff line number Diff line Loading @@ -433,21 +433,16 @@ EXPORT_SYMBOL(snd_pcm_format_set_silence); */ int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) { static unsigned rates[] = { /* ATTENTION: these values depend on the definition in pcm.h! */ 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 }; int i; for (i = 0; i < (int)ARRAY_SIZE(rates); i++) { for (i = 0; i < (int)snd_pcm_known_rates.count; i++) { if (runtime->hw.rates & (1 << i)) { runtime->hw.rate_min = rates[i]; runtime->hw.rate_min = snd_pcm_known_rates.list[i]; break; } } for (i = (int)ARRAY_SIZE(rates) - 1; i >= 0; i--) { for (i = (int)snd_pcm_known_rates.count - 1; i >= 0; i--) { if (runtime->hw.rates & (1 << i)) { runtime->hw.rate_max = rates[i]; runtime->hw.rate_max = snd_pcm_known_rates.list[i]; break; } } Loading sound/core/pcm_native.c +7 −1 Original line number Diff line number Diff line Loading @@ -1787,12 +1787,18 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 }; const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = { .count = ARRAY_SIZE(rates), .list = rates, }; static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { struct snd_pcm_hardware *hw = rule->private; return snd_interval_list(hw_param_interval(params, rule->var), ARRAY_SIZE(rates), rates, hw->rates); snd_pcm_known_rates.count, snd_pcm_known_rates.list, hw->rates); } static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, Loading Loading
include/sound/pcm.h +2 −0 Original line number Diff line number Diff line Loading @@ -922,6 +922,8 @@ snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames); extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, Loading
sound/core/pcm_misc.c +4 −9 Original line number Diff line number Diff line Loading @@ -433,21 +433,16 @@ EXPORT_SYMBOL(snd_pcm_format_set_silence); */ int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) { static unsigned rates[] = { /* ATTENTION: these values depend on the definition in pcm.h! */ 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 }; int i; for (i = 0; i < (int)ARRAY_SIZE(rates); i++) { for (i = 0; i < (int)snd_pcm_known_rates.count; i++) { if (runtime->hw.rates & (1 << i)) { runtime->hw.rate_min = rates[i]; runtime->hw.rate_min = snd_pcm_known_rates.list[i]; break; } } for (i = (int)ARRAY_SIZE(rates) - 1; i >= 0; i--) { for (i = (int)snd_pcm_known_rates.count - 1; i >= 0; i--) { if (runtime->hw.rates & (1 << i)) { runtime->hw.rate_max = rates[i]; runtime->hw.rate_max = snd_pcm_known_rates.list[i]; break; } } Loading
sound/core/pcm_native.c +7 −1 Original line number Diff line number Diff line Loading @@ -1787,12 +1787,18 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 }; const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = { .count = ARRAY_SIZE(rates), .list = rates, }; static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { struct snd_pcm_hardware *hw = rule->private; return snd_interval_list(hw_param_interval(params, rule->var), ARRAY_SIZE(rates), rates, hw->rates); snd_pcm_known_rates.count, snd_pcm_known_rates.list, hw->rates); } static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, Loading