alsa: Use helper function for byte conversion across sample specs

This commit is contained in:
Arun Raghavan 2015-11-16 19:37:20 +05:30
parent f5f6772364
commit d084cf144a
2 changed files with 2 additions and 4 deletions

View file

@ -1020,8 +1020,7 @@ static int update_sw_params(struct userdata *u) {
/* Called from IO Context on unsuspend or from main thread when creating sink */
static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
bool in_thread) {
u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
&u->sink->sample_spec);
u->tsched_watermark = pa_convert_size(tsched_watermark, ss, &u->sink->sample_spec);
u->watermark_inc_step = pa_usec_to_bytes(TSCHED_WATERMARK_INC_STEP_USEC, &u->sink->sample_spec);
u->watermark_dec_step = pa_usec_to_bytes(TSCHED_WATERMARK_DEC_STEP_USEC, &u->sink->sample_spec);

View file

@ -913,8 +913,7 @@ static int update_sw_params(struct userdata *u) {
/* Called from IO Context on unsuspend or from main thread when creating source */
static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss,
bool in_thread) {
u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss),
&u->source->sample_spec);
u->tsched_watermark = pa_convert_size(tsched_watermark, ss, &u->source->sample_spec);
u->watermark_inc_step = pa_usec_to_bytes(TSCHED_WATERMARK_INC_STEP_USEC, &u->source->sample_spec);
u->watermark_dec_step = pa_usec_to_bytes(TSCHED_WATERMARK_DEC_STEP_USEC, &u->source->sample_spec);