summaryrefslogtreecommitdiffstats
path: root/src/modules/alsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/alsa')
-rw-r--r--src/modules/alsa/alsa-sink.c24
-rw-r--r--src/modules/alsa/alsa-source.c17
-rw-r--r--src/modules/alsa/alsa-util.c16
-rw-r--r--src/modules/alsa/alsa-util.h2
4 files changed, 46 insertions, 13 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 0dc0e2b3..f9fb0335 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1173,7 +1173,7 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
/* Let's check whether we now use only a smaller part of the
buffer then before. If so, we need to make sure that subsequent
- rewinds are relative to the new maxium fill level and not to the
+ rewinds are relative to the new maximum fill level and not to the
current fill level. Thus, let's do a full rewind once, to clear
things up. */
@@ -1286,7 +1286,7 @@ static void thread_func(void *userdata) {
pa_log_info("Starting playback.");
snd_pcm_start(u->pcm_handle);
- pa_smoother_resume(u->smoother, pa_rtclock_usec());
+ pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE);
}
update_smoother(u);
@@ -1300,7 +1300,7 @@ static void thread_func(void *userdata) {
/* USB devices on ALSA seem to hit a buffer
* underrun during the first iterations much
* quicker then we calculate here, probably due to
- * the transport latency. To accomodate for that
+ * the transport latency. To accommodate for that
* we artificially decrease the sleep time until
* we have filled the buffer at least once
* completely.*/
@@ -1495,7 +1495,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
snd_pcm_uframes_t period_frames, tsched_frames;
size_t frame_size;
pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
- pa_usec_t usec;
pa_sink_new_data data;
pa_assert(m);
@@ -1559,10 +1558,14 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
- u->smoother = pa_smoother_new(DEFAULT_TSCHED_BUFFER_USEC*2, DEFAULT_TSCHED_BUFFER_USEC*2, TRUE, 5);
- usec = pa_rtclock_usec();
- pa_smoother_set_time_offset(u->smoother, usec);
- pa_smoother_pause(u->smoother, usec);
+ u->smoother = pa_smoother_new(
+ DEFAULT_TSCHED_BUFFER_USEC*2,
+ DEFAULT_TSCHED_BUFFER_USEC*2,
+ TRUE,
+ TRUE,
+ 5,
+ pa_rtclock_usec(),
+ TRUE);
if (reserve_init(u, pa_modargs_get_value(
ma, "device_id",
@@ -1617,6 +1620,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_assert(u->device_name);
pa_log_info("Successfully opened device %s.", u->device_name);
+ if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+ pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+ goto fail;
+ }
+
if (profile)
pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 348cd082..9c36211b 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -776,7 +776,7 @@ static int unsuspend(struct userdata *u) {
/* FIXME: We need to reload the volume somehow */
snd_pcm_start(u->pcm_handle);
- pa_smoother_resume(u->smoother, pa_rtclock_usec());
+ pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE);
pa_log_info("Resumed successfully...");
@@ -1416,8 +1416,14 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
u->alsa_rtpoll_item = NULL;
- u->smoother = pa_smoother_new(DEFAULT_TSCHED_WATERMARK_USEC*2, DEFAULT_TSCHED_WATERMARK_USEC*2, TRUE, 5);
- pa_smoother_set_time_offset(u->smoother, pa_rtclock_usec());
+ u->smoother = pa_smoother_new(
+ DEFAULT_TSCHED_WATERMARK_USEC*2,
+ DEFAULT_TSCHED_WATERMARK_USEC*2,
+ TRUE,
+ TRUE,
+ 5,
+ pa_rtclock_usec(),
+ FALSE);
if (reserve_init(u, pa_modargs_get_value(
ma, "device_id",
@@ -1469,6 +1475,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_assert(u->device_name);
pa_log_info("Successfully opened device %s.", u->device_name);
+ if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+ pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+ goto fail;
+ }
+
if (profile)
pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 5b5270b8..870cf0f1 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -705,7 +705,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
} else {
/* Hmm, so the next entry does not have the same
* number of channels, so let's go backwards until we
- * find the next entry with a differnt number of
+ * find the next entry with a different number of
* channels */
for (i--; i >= 0; i--)
@@ -1063,7 +1063,7 @@ snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const
fallback_elem = NULL;
}
- pa_log_warn("Cannot find fallback mixer control \"%s\" or mixer control is no combination of switch/volume.", snd_mixer_selem_id_get_name(sid));
+ pa_log_info("Cannot find fallback mixer control \"%s\" or mixer control is no combination of switch/volume.", snd_mixer_selem_id_get_name(sid));
}
if (elem && fallback_elem) {
@@ -1769,3 +1769,15 @@ pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) {
return snd_pcm_info_get_card(info) >= 0;
}
+
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) {
+ snd_pcm_info_t* info;
+ snd_pcm_info_alloca(&info);
+
+ pa_assert(pcm);
+
+ if (snd_pcm_info(pcm, info) < 0)
+ return FALSE;
+
+ return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM;
+}
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 5cad2958..94f27d14 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -141,4 +141,6 @@ char *pa_alsa_get_reserve_name(const char *device);
pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
+
#endif