[pulseaudio-discuss] [PATCH] tests: improve resampler test

2011-04-19 Thread Tanu Kaskinen
From: Marc-André Lureau marcandre.lur...@gmail.com

---
 src/tests/resampler-test.c |  207 +--
 1 files changed, 197 insertions(+), 10 deletions(-)

diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 82198b5..69d7ab0 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -22,7 +22,13 @@
 #endif
 
 #include stdio.h
+#include getopt.h
+#include locale.h
 
+#include pulse/i18n.h
+#include pulse/pulseaudio.h
+
+#include pulse/rtclock.h
 #include pulse/sample.h
 #include pulse/volume.h
 
@@ -31,6 +37,8 @@
 #include pulsecore/endianmacros.h
 #include pulsecore/memblock.h
 #include pulsecore/sample-util.h
+#include pulsecore/core-rtclock.h
+#include pulsecore/core-util.h
 
 static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
 void *d;
@@ -241,10 +249,78 @@ static pa_memblock* generate_block(pa_mempool *pool, 
const pa_sample_spec *ss) {
 return r;
 }
 
+static void help(const char *argv0) {
+printf(_(%s [options]\n\n
+ -h, --helpShow this help\n
+ -v, --verbose Print debug messages\n
+   --from-rate=SAMPLERATE  From sample rate in Hz 
(defaults to 44100)\n
+   --from-format=SAMPLEFORMAT  From sample type (defaults 
to s16le)\n
+   --from-channels=CHANNELSFrom number of channels 
(defaults to 1)\n
+   --to-rate=SAMPLERATETo sample rate in Hz 
(defaults to 44100)\n
+   --to-format=SAMPLEFORMATTo sample type (defaults 
to s16le)\n
+   --to-channels=CHANNELS  To number of channels 
(defaults to 1)\n
+   --resample-method=METHODResample method (defaults 
to auto)\n
+   --seconds=SECONDS   From stream duration 
(defaults to 60)\n
+ \n
+ If the formats are not specified, the test performs all formats 
combinations,\n
+ back and forth.\n
+ \n
+ Sample type must be one of s16le, s16be, u8, float32le, 
float32be, ulaw, alaw,\n
+ 32le, s32be (defaults to s16ne)\n
+ \n
+ See --dump-resample-methods for possible values of resample 
methods.\n),
+ argv0);
+}
+
+enum {
+ARG_VERSION = 256,
+ARG_FROM_SAMPLERATE,
+ARG_FROM_SAMPLEFORMAT,
+ARG_FROM_CHANNELS,
+ARG_TO_SAMPLERATE,
+ARG_TO_SAMPLEFORMAT,
+ARG_TO_CHANNELS,
+ARG_SECONDS,
+ARG_RESAMPLE_METHOD,
+ARG_DUMP_RESAMPLE_METHODS
+};
+
+static void dump_resample_methods(void) {
+int i;
+
+for (i = 0; i  PA_RESAMPLER_MAX; i++)
+if (pa_resample_method_supported(i))
+printf(%s\n, pa_resample_method_to_string(i));
+
+}
+
 int main(int argc, char *argv[]) {
-pa_mempool *pool;
+pa_mempool *pool = NULL;
 pa_sample_spec a, b;
 pa_cvolume v;
+int ret = 1, verbose = 0, c;
+pa_bool_t all_formats = TRUE;
+pa_resample_method_t method;
+int seconds;
+
+static const struct option long_options[] = {
+{help,  0, NULL, 'h'},
+{verbose,   0, NULL, 'v'},
+{version,   0, NULL, ARG_VERSION},
+{from-rate, 1, NULL, ARG_FROM_SAMPLERATE},
+{from-format,   1, NULL, ARG_FROM_SAMPLEFORMAT},
+{from-channels, 1, NULL, ARG_FROM_CHANNELS},
+{to-rate,   1, NULL, ARG_TO_SAMPLERATE},
+{to-format, 1, NULL, ARG_TO_SAMPLEFORMAT},
+{to-channels,   1, NULL, ARG_TO_CHANNELS},
+{seconds,   1, NULL, ARG_SECONDS},
+{resample-method,   1, NULL, ARG_RESAMPLE_METHOD},
+{dump-resample-methods, 0, NULL, ARG_DUMP_RESAMPLE_METHODS},
+{NULL,0, NULL, 0}
+};
+
+setlocale(LC_ALL, );
+bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
 
 pa_log_set_level(PA_LOG_DEBUG);
 
@@ -252,22 +328,131 @@ int main(int argc, char *argv[]) {
 
 a.channels = b.channels = 1;
 a.rate = b.rate = 44100;
-
+a.format = b.format = PA_SAMPLE_S16LE;
 v.channels = a.channels;
 v.values[0] = pa_sw_volume_from_linear(0.5);
 
+method = PA_RESAMPLER_AUTO;
+seconds = 60;
+
+while ((c = getopt_long(argc, argv, hv, long_options, NULL)) != -1) {
+
+switch (c) {
+case 'h' :
+help(argv[0]);
+ret = 0;
+goto quit;
+
+case 'v':
+pa_log_set_level(PA_LOG_DEBUG);
+verbose = 1;
+ret = 0;
+break;
+
+case ARG_VERSION:
+printf(_(%s %s\n), argv[0], PACKAGE_VERSION);
+ret = 0;
+goto quit;
+
+case ARG_DUMP_RESAMPLE_METHODS:
+dump_resample_methods();
+ret = 0;
+   

Re: [pulseaudio-discuss] [PATCH] interpol-test: remove unused include getopt.h

2011-04-19 Thread Colin Guthrie
Thanks. Merged.

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/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] tests: improve resampler test

2011-04-19 Thread Colin Guthrie
Not reviewed much, but sounds sensible from a brief glance. In my tree now.

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/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] underrun behavior with alsa-plugins

2011-04-19 Thread Maarten Lankhorst

Hi all,

For wine I was investigating a bug with pulseaudio, it seems 
alsa-plugins' pulse driver ignores underruns. This is probably because 
an underrun will force you to call snd_pcm_prepare, this will destroy 
the stream and set up a similar new one again. This causes more 
susceptibility to underruns, so that code was disabled. However if I 
force underruns to occur, the state will stay running and it appears 
there is still some data left in the buffer, so sound stalls entirely. 
The latency gets updated to something like 0x7bdX which 
looks suspiciously much like a pointer to me, which may be a bug. If I 
instead make pulse_prepare call pulse_start on underrun, it's handled 
properly and sound will continue to work.


So my questions are.
1. Is the weird latency value update a bug? Digging it up I can only 
assume it's a bug in src/stream.c , but I haven't figured out why yet. 
Tested with pulseaudio.c

2. Any comments on this patch for alsa-plugins?

Cheers,
Maarten


xrun.patch
Description: application/mbox
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] review+pull-request: Passthrough support

2011-04-19 Thread pl bossart
I finally managed to figure out why eac3 wouldn't work in passthrough
mode. Apparently my HDMI receiver will only lock on eac3 data if the
AES0 control is set to 0x06 (non-audio, ie iec61937).

ffmpeg -acodec copy -i csi_miami_5.1_256_spx.eac3 -f spdif outfile.pcm
aplay -Dhdmi:AES0=0x6 -fs16 -c2 -r192000 outfile.pcm

the same file plays well through pulseaudio if I modifed default.conf to
[Mapping hdmi-stereo]
device-strings = hdmi:%f,AES0=0x06
channel-map = left,right
priority = 4
direction = output

Somehow we need to find a way to set this AES0 byte when opening the
iec958 or hdmi device in the passthrough code, and reset it back to
0x04 for PCM playback (should be fairly easy to do by looking at the
code of iecset in alsa-utils). Beats me why this was not needed for
plain ac3, but setting the audio bit is actually the correct thing to
do.

So far all the tests seem ok with the ffmpeg examples, with the
exception of two files:
- 7_pt_1: works well with ffmpeg, aplay but the sound is way too fast
with pulseaudio. Lots of rewind messages seen in PulseAudio.
- serenity_english_5.1_1536.eac3 file: no sound out, and again lots of
rewind messages (the receiver still shows the D+ logo though). The
same file converted with ffmpeg and played with aplay seems fine.
looks like a buffering issue more than a payloader problem really.

-Pierre
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss