[pulseaudio-discuss] [PATCH 2/8] source: Fix monitor source rate changing

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Aug 8 23:57:53 PDT 2013


Monitor sources don't have the update_rate() callback set, so their rate was
not being changed when changing the sink rate.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66424
---
 src/pulsecore/source.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 2c8d440..c7f0127 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -976,7 +976,7 @@ bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) {
     pa_source_output *o;
     bool use_alternate = false;
 
-    if (!s->update_rate)
+    if (!s->update_rate && !s->monitor_of)
         return false;
 
     if (PA_UNLIKELY(default_rate == alternate_rate)) {
@@ -1025,7 +1025,12 @@ 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) {
+    if (!s->update_rate || s->update_rate(s, desired_rate) == true) {
+        if (!s->update_rate) {
+            pa_assert(s->monitor_of);
+            s->sample_spec.rate = desired_rate;
+        }
+
         pa_log_info("Changed sampling rate successfully ");
 
         PA_IDXSET_FOREACH(o, s->outputs, idx) {
-- 
1.8.1.2



More information about the pulseaudio-discuss mailing list