summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-08-09 07:45:26 +0300
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-08-27 15:34:33 +0300
commit2c14306507ce5049fb2bc883acea4f0d8c879876 (patch)
tree95ee8b677001cfd71bd568d491d6809df85cfe3e
parent9a590dd3f258bb7ea420a36196e4c4a7e549753a (diff)
source: Fix monitor source rate changing
When a sink changes its sample rate, also the monitor source rate needs to be changed. In order to determine whether a source supports rate changing, the code checks if the update_rate() callback is set, but monitor sources don't have that callback set, so the old code always failed to change the monitor source rate. This patch fixes the monitor source rate changing by handling monitor sources as a special case in pa_source_update_rate(): if the source is a monitor source, then the update_rate() callback is not required. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66424
-rw-r--r--src/pulsecore/source.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 5cb6b73af..c69251127 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -972,14 +972,12 @@ bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) {
uint32_t desired_rate = rate;
uint32_t default_rate = s->default_sample_rate;
uint32_t alternate_rate = s->alternate_sample_rate;
- uint32_t idx;
- pa_source_output *o;
bool use_alternate = false;
if (rate == s->sample_spec.rate)
return true;
- if (!s->update_rate)
+ if (!s->update_rate && !s->monitor_of)
return false;
if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough)) {
@@ -1027,14 +1025,24 @@ bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) {
pa_log_debug("Suspending source %s due to changing the sample rate.", s->name);
pa_source_suspend(s, true, PA_SUSPEND_INTERNAL);
- if (s->update_rate(s, desired_rate) == true) {
- pa_log_info("Changed sampling rate successfully ");
+ if (s->update_rate)
+ ret = s->update_rate(s, desired_rate);
+ else {
+ /* This is a monitor source. */
+ s->sample_spec.rate = desired_rate;
+ ret = true;
+ }
+
+ if (ret) {
+ uint32_t idx;
+ pa_source_output *o;
PA_IDXSET_FOREACH(o, s->outputs, idx) {
if (o->state == PA_SOURCE_OUTPUT_CORKED)
pa_source_output_update_rate(o);
}
- ret = true;
+
+ pa_log_info("Changed sampling rate successfully");
}
pa_source_suspend(s, false, PA_SUSPEND_INTERNAL);