[pulseaudio-discuss] [PATCH] alsa: Use helper function for byte conversion across sample specs
arun at accosted.net
arun at accosted.net
Mon Nov 16 06:19:38 PST 2015
From: Arun Raghavan <git at arunraghavan.net>
---
src/modules/alsa/alsa-sink.c | 3 +--
src/modules/alsa/alsa-source.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 476188c..c5a72c3 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -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);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d7d3eb5..4683dfe 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -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);
--
2.5.0
More information about the pulseaudio-discuss
mailing list