'Twas brillig, and Colin Guthrie at 06/08/11 13:13 did gyre and gimble:
> 'Twas brillig, and David Henningsson at 04/08/11 20:41 did gyre and gimble:
>> Note that this only happened after disabling flat-volumes.
>>
>> This is from currently recording into Audacity, and using pavucontrol to
>> change the source output volume.
> 
> Thanks for this. Will try and have a look today or tomorrow.

OK, I got the same BT and I think it's just an overzealous copy and
paste from sink code... I think all it needs is the switching round of
some sample specs (source ss <-> source output ss).

The attached patch seems to fix it for me (it was messed up in flat
volume mode too - sounded terrible at times, but didn't actually crash
for me - Arun, could this also be the source of the "gstreamer problem"?)


Also I just confused myself because stream-restore was not restoring
source-output volumes..... need to add that in :)


Cheers.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
>From 58e6071f6aae0f8853511dff96dee2158ef08326 Mon Sep 17 00:00:00 2001
From: Colin Guthrie <[email protected]>
Date: Sat, 6 Aug 2011 23:05:27 +0200
Subject: [PATCH] source-output: Fix resampling.

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

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to