[PATCH] source-output: Fix resampling.

Colin Guthrie colin at mageia.org
Sat Aug 6 14:05:27 PDT 2011


When recording, we need to reverse the order of sample specs
(origin<->destination) from the sink code this was copied form.
---
 src/pulsecore/source-output.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 59b6c2f..b331287 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -708,7 +708,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
 
         latency = pa_sink_get_latency_within_thread(o->source->monitor_of);
 
-        n = pa_usec_to_bytes(latency, &o->source->sample_spec);
+        n = pa_usec_to_bytes(latency, &o->source.sample_spec);
 
         if (n < limit)
             limit = n;
@@ -733,7 +733,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
             pa_memchunk_make_writable(&qchunk, 0);
 
             if (o->thread_info.muted) {
-                pa_silence_memchunk(&qchunk, &o->thread_info.sample_spec);
+                pa_silence_memchunk(&qchunk, &o->source->sample_spec);
                 nvfs = FALSE;
 
             } else if (!o->thread_info.resampler && nvfs) {
@@ -743,17 +743,17 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
                  * post and the pre volume adjustment into one */
 
                 pa_sw_cvolume_multiply(&v, &o->thread_info.soft_volume, &o->volume_factor_source);
-                pa_volume_memchunk(&qchunk, &o->thread_info.sample_spec, &v);
+                pa_volume_memchunk(&qchunk, &o->source->sample_spec, &v);
                 nvfs = FALSE;
 
             } else
-                pa_volume_memchunk(&qchunk, &o->thread_info.sample_spec, &o->thread_info.soft_volume);
+                pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->thread_info.soft_volume);
         }
 
         if (!o->thread_info.resampler) {
             if (nvfs) {
                 pa_memchunk_make_writable(&qchunk, 0);
-                pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->volume_factor_source);
+                pa_volume_memchunk(&qchunk, &o->thread_info.sample_spec, &o->volume_factor_source);
             }
 
             o->push(o, &qchunk);
@@ -771,7 +771,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
             if (rchunk.length > 0) {
                 if (nvfs) {
                     pa_memchunk_make_writable(&rchunk, 0);
-                    pa_volume_memchunk(&rchunk, &o->source->sample_spec, &o->volume_factor_source);
+                    pa_volume_memchunk(&rchunk, &o->thread_info.sample_spec, &o->volume_factor_source);
                 }
 
                 o->push(o, &rchunk);
-- 
1.7.6


--------------090306030907040507040906--


More information about the pulseaudio-discuss mailing list