[pulseaudio-discuss] Add a new target to Pulseaudio log feature

2010-11-05 Thread Becker, VincentX
Hi all,



I would like to add in the log feature of PA a way to log(redirect) 'pa_log_*' 
messages in a file, which can be a char device for ex. That means adding a 
target to the log of pulseaudio. This target is not settable yet and I made 
changes in Pulseaudio for enabling a new log target of file type.

Would it be possible to add them in Pulseaudio and shall I create a ticket for 
this ?

Could you provide me some details in the process of upstreaming on PA.org ?

I can quickly provide the code for our needs.



Thanks



Vincent BECKER

Intel - Wireless System Integration Engineer

Medfield platform
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] Add a target to the PA log feature and improve PA log core

2010-11-22 Thread Becker, VincentX
Hi all,

Could you please review this patch ?
This is a patch that adds a generic log target for PA log (log.c). This new 
target can be either a char device or a regular file. For our remote log device 
needs, it has been necessary to directly log Pulseaudio traces to a file 
descriptor. 

Also optimizations in the memory allocations have been done to reuse local 
pointers to prevent extra memory allocations (on stack or heap), that would 
happen in case of very big trace buffers, and that could potentially have an 
impact on audio latency in embedded systems.

Modifications :

src/daemon/cmdline.c : Update Pulseaudio help and error message for the 
'log-target' command argument.
src/daemon/daemon-conf.c : Add the condition when the target given is a file 
name given with relative or absolute path. If the file already exists, it 
creates a new file that will contain the current date and time inserted in the 
name. For this purpose, two static utilities functions have been added. The 
file descriptor is then passed to the PA log in pulsecore.

src/pulsecore/log.c : The function pa_log_levelv_meta formats the text data and 
sends it to the appropriate target. There are 2 main changes :
1) Add the target PA_LOG_FILED which allows to write the formatted log data to 
a file descriptor output. Add functions to open and close that file descriptor.
2) the algorithms around 'char *t' have been reordered in order to optimize 
memory use. This could be useful when traces are big. The trace buffer char 
text has been set to 16*1024Kb which allocates already 16Kb on the stack. This 
buffer is then copied into t, in the for loop that checks for carriage returns. 
What needed to be optimized is that extra memory is allocated in case of 
metadata (location and timestamp) is prepended to t, by creating dynamically a 
new buffer. The idea is to prepend the data directly into t (and append if it's 
the case) before we affect the value of 'text'. It avoids one dynamic memory 
allocation, at least in the case of the new target PA_LOG_FILED.
Therefore, a 'metadata' buffer is created and prepended in t whatever the 
target. One switch/case is actually added to build this metadata buffer and we 
keep the other one just for write the actual log (text+metadata) in the target.

P.S. : there are bad indentations due to tabs. I use emacs and tried the 
indentation Lisp function given here but without success : 
http://www.pulseaudio.org/wiki/CodingStyle  . It keeps putting tabs instead of 
spaces ! How could I solve that ?

Thanks,

Vincent


Vincent BECKER
Intel - Wireless System Integration Engineer
Medfield platform 


-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Pulseaudio-Add-a-target-to-PA-log-feature-and-optimi.patch
Description: 0001-Pulseaudio-Add-a-target-to-PA-log-feature-and-optimi.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH]sndfile-util : Correct wav file creation/writing for 24-32 and 24 bits PCM sample formats

2011-02-08 Thread Becker, VincentX
Hi,

This patch corrects format values that are set for specific sample formats 
PA_SAMPLE_S24NE and PA_SAMPLE_S24_32NE, for wav file creation and writing. Also 
PA_SAMPLE_S24_32NE was not fully supported in sndfile-util.c. For the unusual 
format PA_SAMPLE_S24_32NE, sfi format has to be SF_FORMAT_PCM_32 as the audio 
is coded on 32 bits. In this case, one has to shift 8 bits on the left 24 bits 
in order to fit into the MSB audio data on 32 bits.

Vincent


---
 src/pulsecore/sndfile-util.c |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index 9d15a86..cadda93 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -51,6 +51,9 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec 
*ss) {
 break;
 
 case SF_FORMAT_PCM_24:
+ss-format = PA_SAMPLE_S24NE;
+   break;
+
 case SF_FORMAT_PCM_32:
 ss-format = PA_SAMPLE_S32NE;
 break;
@@ -106,10 +109,14 @@ int pa_sndfile_write_sample_spec(SF_INFO *sfi, 
pa_sample_spec *ss) {
 
 case PA_SAMPLE_S24LE:
 case PA_SAMPLE_S24BE:
+   ss-format = PA_SAMPLE_S24NE;
+   sfi-format |= SF_FORMAT_PCM_24;
+   break;
+
 case PA_SAMPLE_S24_32LE:
 case PA_SAMPLE_S24_32BE:
-ss-format = PA_SAMPLE_S32NE;
-sfi-format |= SF_FORMAT_PCM_24;
+ss-format = PA_SAMPLE_S24_32NE;
+sfi-format |= SF_FORMAT_PCM_32;
 break;
 
 case PA_SAMPLE_S32LE:
@@ -362,6 +369,7 @@ pa_sndfile_readf_t pa_sndfile_readf_function(const 
pa_sample_spec *ss) {
 return (pa_sndfile_readf_t) sf_readf_short;
 
 case PA_SAMPLE_S32NE:
+case PA_SAMPLE_S24_32NE:
 return (pa_sndfile_readf_t) sf_readf_int;
 
 case PA_SAMPLE_FLOAT32NE:
@@ -384,6 +392,7 @@ pa_sndfile_writef_t pa_sndfile_writef_function(const 
pa_sample_spec *ss) {
 return (pa_sndfile_writef_t) sf_writef_short;
 
 case PA_SAMPLE_S32NE:
+case PA_SAMPLE_S24_32NE:
 return (pa_sndfile_writef_t) sf_writef_int;
 
 case PA_SAMPLE_FLOAT32NE:
-- 
1.7.2.3

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Correct-wav-file-creation-for-24-32-and-24-bits-samp.patch
Description: 0001-Correct-wav-file-creation-for-24-32-and-24-bits-samp.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] Add a target to the PA log feature and improve PA log core

2011-02-23 Thread Becker, VincentX
-Original Message-
From: Maarten Bosmans [mailto:mkbosm...@gmail.com]
Sent: Wednesday, February 23, 2011 3:50 PM
To: General PulseAudio Discussion
Cc: Becker, VincentX
Subject: Re: [pulseaudio-discuss] [PATCH] Add a target to the PA log
feature and improve PA log core

Here's my review of that patch. It will be handled in the meeting
tomorrow, but I'm sure I've forgotten by then, so I sent it to the
list.

2010/11/22 Becker, VincentX vincentx.bec...@intel.com:
 Hi all,

 Could you please review this patch ?
 This is a patch that adds a generic log target for PA log (log.c).
This new target can be either a char device or a regular file. For our
remote log device needs, it has been necessary to directly log
Pulseaudio traces to a file descriptor.

 Also optimizations in the memory allocations have been done to reuse
local pointers to prevent extra memory allocations (on stack or heap),
that would happen in case of very big trace buffers, and that could
potentially have an impact on audio latency in embedded systems.

 Modifications :

 src/daemon/cmdline.c : Update Pulseaudio help and error message for
the 'log-target' command argument.

The current help message has a width of 80 characters. It would be
nice to keep it that way and find another way to fit the new
log-target argument in there.

 src/daemon/daemon-conf.c : Add the condition when the target given is
a file name given with relative or absolute path. If the file already
exists, it creates a new file that will contain the current date and
time inserted in the name. For this purpose, two static utilities
functions have been added. The file descriptor is then passed to the PA
log in pulsecore.

I don't think the renaming with the data appended to the filename is
functionality that belongs in pulseaudio. If you want serious logging,
use syslog, if you want quick-and-dirty, use the filename. Pulse
should just append or overwrite the file, either is fine.

Also, as daemon-conf opens the file, it should call pa_close itself
too. Then the pa_log_close_fd function can be removed.

 src/pulsecore/log.c : The function pa_log_levelv_meta formats the text
data and sends it to the appropriate target. There are 2 main changes :
 1) Add the target PA_LOG_FILED which allows to write the formatted log
data to a file descriptor output. Add functions to open and close that
file descriptor.

This would better be called PA_LOG_FD

 2) the algorithms around 'char *t' have been reordered in order to
optimize memory use. This could be useful when traces are big. The trace
buffer char text has been set to 16*1024Kb which allocates already
16Kb on the stack. This buffer is then copied into t, in the for loop
that checks for carriage returns. What needed to be optimized is that
extra memory is allocated in case of metadata (location and timestamp)
is prepended to t, by creating dynamically a new buffer. The idea is to
prepend the data directly into t (and append if it's the case) before we
affect the value of 'text'. It avoids one dynamic memory allocation, at
least in the case of the new target PA_LOG_FILED.
 Therefore, a 'metadata' buffer is created and prepended in t whatever
the target. One switch/case is actually added to build this metadata
buffer and we keep the other one just for write the actual log
(text+metadata) in the target.

Please separate this change out in another patch. That way it can be
reviewed better.

 P.S. : there are bad indentations due to tabs. I use emacs and tried
the indentation Lisp function given here but without success :
http://www.pulseaudio.org/wiki/CodingStyle  . It keeps putting tabs
instead of spaces ! How could I solve that ?

 Thanks,

 Vincent

Maarten

Thanks for your review Maarten. So you suggest to split this into several 
patches (2). One for the outer implementation and the other for the inner one. 
I will try to attend to the irc meeting tomorrow so I can catch your remarks in 
real time.

Cheers,
V.


 Vincent BECKER
 Intel - Wireless System Integration Engineer
 Medfield platform


Ah, to bad you send it to a public list then. I guess we're all
criminals now ;-)
:-)

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


-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https

Re: [pulseaudio-discuss] [PATCH] Add a target to the PA log feature and improve PA log core

2011-02-24 Thread Becker, VincentX
From: Maarten Bosmans [mailto:mkbosm...@gmail.com]

2011/2/23 Becker, VincentX vincentx.bec...@intel.com:
 Thanks for your review Maarten. So you suggest to split this into
several patches (2). One for the outer implementation and the other for
the inner one. I will try to attend to the irc meeting tomorrow so I can
catch your remarks in real time.

I'm not sure what you mean by outer and inner implementation. What I
meant was one patch thats adds the option to log to a file (this patch
touches all four files) and one patch that does the metadata,
append_data thing (should only change src/pulsecore/log.c)

Having two clean patches (see my other comments) tomorrow would help
to keep thing moving in the meeting.

Hi Maarten, 
Here are the 2 patches as you suggested (both patches can be compiled 
separately). I also integrated one of your remarks, but not all. Like 
concerning the file naming, as you said it might be a bit too complicated and 
appending the file or creating a new one might be enough. But it remains a 
powerful way to debug pulseaudio and it is more direct than using syslog.
I also wrote a module dedicated to log PCM samples, configurable for sinks 
and/or sources with or without their respective sink inputs/source outputs. I 
will submit it probably next month.

Vince


Sorry for getting this rolling on such a short notice.
No problem at all!

Maarten


 Cheers,
 V.
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Add-a-new-log-target-to-a-file-descriptor-in-daemon-.patch
Description: 0001-Add-a-new-log-target-to-a-file-descriptor-in-daemon-.patch


0001-Format-log-messages-with-generic-prepended-and-appen.patch
Description: 0001-Format-log-messages-with-generic-prepended-and-appen.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] Add a target to the PA log feature

2011-02-24 Thread Becker, VincentX
From: Maarten Bosmans [mailto:mkbosm...@gmail.com]

2011/2/23 Becker, VincentX vincentx.bec...@intel.com:
 Thanks for your review Maarten. So you suggest to split this into
several patches (2). One for the outer implementation and the other for
the inner one. I will try to attend to the irc meeting tomorrow so I
can catch your remarks in real time.

I'm not sure what you mean by outer and inner implementation. What I
meant was one patch thats adds the option to log to a file (this patch
touches all four files) and one patch that does the metadata,
append_data thing (should only change src/pulsecore/log.c)

Having two clean patches (see my other comments) tomorrow would help to
keep thing moving in the meeting.

Hi Maarten,
Here are the 2 patches as you suggested (both patches can be compiled
separately). I also integrated one of your remarks, but not all. Like
concerning the file naming, as you said it might be a bit too
complicated and appending the file or creating a new one might be
enough. But it remains a powerful way to debug pulseaudio and it is more
direct than using syslog.
I also wrote a module dedicated to log PCM samples, configurable for
sinks and/or sources with or without their respective sink inputs/source
outputs. I will submit it probably next month.

Vince


I send again the patches as the older ones could not be applied.


Sorry for getting this rolling on such a short notice.
No problem at all!

Maarten


 Cheers,
 V.
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Add-a-new-log-target-to-a-file-descriptor-in-daemon-.patch
Description: 0001-Add-a-new-log-target-to-a-file-descriptor-in-daemon-.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/2] Improve and optimize PA log core

2011-02-24 Thread Becker, VincentX
This patch goes with previous one 
(0001-Add-a-new-log-target-to-a-file-descriptor-in-daemon-.patch)

Vincent
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Format-log-messages-with-generic-prepended-and-appen.patch
Description: 0001-Format-log-messages-with-generic-prepended-and-appen.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] Add a target to the PA log feature

2011-02-25 Thread Becker, VincentX
From: Maarten Bosmans [mailto:mkbosm...@gmail.com]
Sent: Friday, February 25, 2011 1:10 AM
To: Becker, VincentX
Cc: General PulseAudio Discussion
Subject: Re: [pulseaudio-discuss] [PATCH 1/2] Add a target to the PA log
feature

The patches were handled at the meeting yesterday
http://colin.guthr.ie/meetings/pulseaudio-meeting/2011/pulseaudio-
meeting.2011-02-24-21.02.html

Some changes are necessary, but basically adding the file log target
is ACKed. The other change about string format handling needs further
review though.

If you need some help with getting patches ready, I can be of
assistance, just let me know.

Maarten

Hi Maarten,
I checked the review comments and there are quite few things I don't fully 
know/understand. It is spoken about rotation logic at some time. What does it 
mean exactly ? And Lennart used the s-o-b acronym; what does it mean ? (we 
don't do s-o-b btw). I fully agree with the changes proposed and will do them 
and resend (1 or 2 ?) patches. It should be Ok for the patch generation, I will 
dig the subject.
However the second one needs still to wait to be reviewed, right ?

Thanks 
Vincent


-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] Add a target to the PA log feature

2011-02-25 Thread Becker, VincentX
-Original Message-
From: pulseaudio-discuss-boun...@mail.0pointer.de [mailto:pulseaudio-
discuss-boun...@mail.0pointer.de] On Behalf Of Paul Menzel
Sent: Thursday, February 24, 2011 11:15 PM
To: pulseaudio-discuss@mail.0pointer.de
Subject: Re: [pulseaudio-discuss] [PATCH 1/2] Add a target to the PA log
feature

Dear VincentX,


please note in the subject what iteration your patch is, e. g. »[PATCH
1/2 v2]«. See `--subject-prefix` in `git help format-patch`.

Ok I will check this. Also I will include an example in the commit message.

Am Donnerstag, den 24.02.2011, 16:30 + schrieb Becker, VincentX:
 From 55f84afd8575dadba697c746daa61ee07b333c57 Mon Sep 17 00:00:00 2001
 From: Vincent Becker vincentx.bec...@intel.com
 Date: Thu, 24 Feb 2011 16:52:05 +0100
 Subject: [PATCH] Add a new log target to a file descriptor in daemon
 configuration
  Signed-off-by: Vincent Becker vincentx.bec...@intel.com  This
 patches adds the option to log pulseaudio messages into a file
descriptor.

Could you add that indentation change in a separate patch? It makes it
easier to review in my opinion. It is not necessary though.
Uh..

[…]

Could you also document the new option in the manual and add an example
to it? Do the config file templates also need to be updated?
How do I update this manual ? I need to do some changes before redelivering the 
patches and I will check the config file templates as well.
Thx. Vincent


Thanks,

Paul
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 2/2] Log feature: optimize log data format before writing to target

2011-03-08 Thread Becker, VincentX
-Original Message-
From: pulseaudio-discuss-boun...@mail.0pointer.de [mailto:pulseaudio-
discuss-boun...@mail.0pointer.de] On Behalf Of Vincent Becker
Sent: Tuesday, March 08, 2011 5:15 PM
To: pulseaudio-discuss@mail.0pointer.de
Subject: [pulseaudio-discuss] [PATCH 2/2] Log feature: optimize log data
format before writing to target


Note that this patch would need to be discussed on the list. Its main purpose 
is to avoid multiple calls to write, which can be the case when writing to a 
file descriptor. Indeed, the patch applied before did 2 calls to write as the 
metadata needed to be formatted in a new buffer and written apart of the text 
log message. Making only 1 call to write instead of 2 can be precious in 
embedded environments. It was easier and clearer to apply this change to all 
the log targets : 'char *t' now contains in order 'metadata - text - 
append_data' (append_data is not used in every case though). It also has the 
advantage to clarify a bit which data in which case is logged..

Vincent


Format data appended and prepended to the log message so that only one
call to write is necessary

Signed-off-by: Vincent Becker vincentx.bec...@intel.com
---
 src/pulsecore/log.c |  160 ++--
---
 1 files changed, 95 insertions(+), 65 deletions(-)

diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index a5e26c8..abb9066 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -277,10 +277,12 @@ void pa_log_levelv_meta(
 pa_log_level_t _maximum_level;
 unsigned _show_backtrace;
 pa_log_flags_t _flags;
+char *local_t;
+int metadata_length;

 /* We don't use dynamic memory allocation here to minimize the hit
  * in RT threads */
-char text[16*1024], location[128], timestamp[32];
+char text[16*1024], location[128], timestamp[32], metadata[256],
append_data[256];

 pa_assert(level  PA_LOG_LEVEL_MAX);
 pa_assert(format);
@@ -297,8 +299,6 @@ void pa_log_levelv_meta(
 return;
 }

-pa_vsnprintf(text, sizeof(text), format, ap);
-
 if ((_flags  PA_LOG_PRINT_META)  file  line  0  func)
 pa_snprintf(location, sizeof(location), [%s:%i %s()] , file,
line, func);
 else if ((_flags  (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE))  file)
@@ -338,90 +338,120 @@ void pa_log_levelv_meta(
 bt = get_backtrace(_show_backtrace);
 #endif

-if (!pa_utf8_valid(text))
+switch (_target) {
+
+case PA_LOG_STDERR: {
+const char *prefix = , *suffix = , *grey = ;
+
+#ifndef OS_IS_WIN32
+  /* Yes indeed. Useless, but fun! */
+  if ((_flags  PA_LOG_COLORS)  isatty(STDERR_FILENO)) {
+  if (level = PA_LOG_ERROR)
+  prefix = \x1B[1;31m;
+  else if (level = PA_LOG_WARN)
+  prefix = \x1B[1m;
+
+  if (bt)
+  grey = \x1B[2m;
+
+  if (grey[0] || prefix[0])
+  suffix = \x1B[0m;
+  }
+#endif
+if (_flags  PA_LOG_PRINT_LEVEL)
+pa_snprintf(metadata, sizeof(metadata), %s%c: %s%s,
timestamp, level_to_char[level], location, prefix);
+  else
+pa_snprintf(metadata, sizeof(metadata), %s%s%s,
timestamp, location, prefix);
+
+  pa_snprintf(append_data, sizeof(append_data), %s%s%s, grey,
pa_strempty(bt), suffix);
+
+  break;
+}
+
+#ifdef HAVE_SYSLOG_H
+case PA_LOG_SYSLOG: {
+pa_snprintf(metadata, sizeof(metadata), %s%s, timestamp,
location);
+  pa_snprintf(append_data, sizeof(append_data) ,%s,
pa_strempty(bt));
+
+break;
+}
+#endif
+
+case PA_LOG_FD: {
+  pa_snprintf(metadata, sizeof(metadata), \n%c %s%s,
level_to_char[level], timestamp, location);
+
+append_data[0] = 0;
+
+break;
+}
+
+default:
+metadata[0] = 0;
+  append_data[0] = 0;
+
+break;
+}
+
+metadata_length = strlen(metadata);
+
+/* Format text at metadata_length position */
+pa_vsnprintf(text[metadata_length], sizeof(text) -
metadata_length, format, ap);
+
+if (!pa_utf8_valid(text[metadata_length]))
 pa_logl(level, Invalid UTF-8 string following below:);

-for (t = text; t; t = n) {
-if ((n = strchr(t, '\n'))) {
-*n = 0;
-n++;
-}
+/* We shouldn't be using dynamic allocation here to
+ * minimize the hit in RT threads */
+if ((local_t = pa_utf8_to_locale(text[metadata_length]))) {
+  strcpy(text[metadata_length], local_t);
+  pa_xfree(local_t);
+}
+
+for (t = text[metadata_length]; t; t = n) {
+  if ((n = strchr(t, '\n'))) {
+  *n = 0;
+  n++;
+  }

 /* We ignore strings only made out of whitespace */
 if (t[strspn(t, \t )] == 0)
 continue;

-switch (_target) {
+  /* Rewind to the start of the t buffer */
+  t -= metadata_length;

-case PA_LOG_STDERR: {
-const char *prefix = , *suffix = , *grey = ;
-char *local_t;
+  

Re: [pulseaudio-discuss] [PATCH 1/2] Log feature:Add a new log target to a file descriptor

2011-03-09 Thread Becker, VincentX
-Original Message-
From: pulseaudio-discuss-boun...@mail.0pointer.de [mailto:pulseaudio-
discuss-boun...@mail.0pointer.de] On Behalf Of Maarten Bosmans
Sent: Wednesday, March 09, 2011 5:31 PM
To: General PulseAudio Discussion
Subject: Re: [pulseaudio-discuss] [PATCH 1/2] Log feature:Add a new log
target to a file descriptor

2011/3/9 Vincent Becker vincentx.bec...@intel.com:
 @@ -185,7 +193,23 @@ int pa_daemon_conf_set_log_target(pa_daemon_conf
*c, const char *string) {
     } else if (!strcmp(string, stderr)) {
         c-auto_log_target = 0;
         c-log_target = PA_LOG_STDERR;
 -    } else
 +    } else if (pa_startswith(string, file:)) {
 +        char file_path[512];
 +
 +        strncpy(file_path, string+5, sizeof(file_path));

This is potentially unsafe, use pa_strlcpy.

Ok I will use it instead.


 +
 +        /* Open target file with user rights */
 +        if ((log_fd = open(file_path, O_RDWR|O_TRUNC|O_CREAT,
S_IRWXU)) = 0) {
 +            c-auto_log_target = 0;
 +            c-log_target = PA_LOG_FD;
 +            pa_log_set_fd(log_fd);
 +        }
 +        else {
 +            printf(Failed to open target file %s, error : %s\n,
file_path, pa_cstrerror(errno));
 +            return -1;
 +        }
 +    }
 +    else
         return -1;

     return 0;


 @@ -399,6 +407,24 @@ void pa_log_levelv_meta(
             }
  #endif

 +            case PA_LOG_FD: {
 +                if (log_fd != -1) {
 +                    char metadata[256];
 +
 +                    pa_snprintf(metadata, sizeof(metadata), \n%c
%s%s, level_to_char[level], timestamp, location);
 +
 +                    if ((write(log_fd, metadata, strlen(metadata)) 
0) || (write(log_fd, t, strlen(t))  0)) {
 +                        saved_errno = errno;
 +                        pa_close(log_fd);
 +                        log_fd = -1;
 +                    }
 +                }
 +                else
 +                    fprintf(stderr, %s\n, Invalid file descriptor.
Could not write log message.);

Wouldn't this result in lots and lots of the same messages to stderr?
It seems better to move this message to the case when the write fails,
or just print the log message here, or both.

Yes it will indeed. So we probably prefer to print first the log message itself 
then print a warning message with the errno - using printf, then change the 
target dynamically to PA_LOG_STDERR as Arun suggested, using 
pa_log_set_target(). Also the target in daemon configuration will stay 
PA_LOG_FD which should be no problem. Also calling twice pa_close is harmless I 
guess, but we could probably remove it from here. 


 +
 +                break;
 +            }
 +
             case PA_LOG_NULL:
             default:
                 break;

Maarten
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] Log feature: Add a new log target to a file descriptor

2011-03-18 Thread Becker, VincentX
-Original Message-
From: pulseaudio-discuss-boun...@mail.0pointer.de [mailto:pulseaudio-
discuss-boun...@mail.0pointer.de] On Behalf Of Colin Guthrie
Sent: Friday, March 18, 2011 1:48 PM
To: pulseaudio-discuss@mail.0pointer.de
Subject: Re: [pulseaudio-discuss] [PATCH 1/2] Log feature: Add a new log
target to a file descriptor

'Twas brillig, and Vincent Becker at 18/03/11 10:23 did gyre and gimble:
 This patch enables logging of text debug messages (pa_log feature)
into a file or a device driver.
 Example : pulseaudio --log-target=file:./mylog.txt

Many thanks for your perseverence here. We were beginning to worry we
were annoying you too much with constant tweaks for a relatively simple
patch.


Hi Col,
I actually crashed my Linux environment, this is why it took me some time to 
recover and get back to you.

I did actually make a couple extra tweaks on top of this one which I've
attached FYI. One of them was to fix the double close that Arun pointed
out before and was still in this version.

If I've cocked it up, please feel free to publicly humiliate me in a
manner of your choosing.


No worries! It's cleaner like that I admit.
Thanks
Vincent

Many thanks.

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/]
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH 1/2] Log feature: Add a new log target to a file descriptor

2011-03-23 Thread Becker, VincentX
'Twas brillig, and Vincent Becker at 18/03/11 10:23 did gyre and
gimble:
 This patch enables logging of text debug messages (pa_log feature)
into a file or a device driver.
 Example : pulseaudio --log-target=file:./mylog.txt

Many thanks for your perseverence here. We were beginning to worry we
were annoying you too much with constant tweaks for a relatively simple
patch.


Hi Col,
I actually crashed my Linux environment, this is why it took me some
time to recover and get back to you.

I did actually make a couple extra tweaks on top of this one which I've
attached FYI. One of them was to fix the double close that Arun pointed
out before and was still in this version.

If I've cocked it up, please feel free to publicly humiliate me in a
manner of your choosing.


No worries! It's cleaner like that I admit.

OOOps! I just noticed a naughty integration error of mine. Unluckily, in the 
process of redelivering, I did not retest so in daemon-conf.c, it is 
implemented in the wrong function pa_daemon_conf_set_log_level. It should be in 
the function just above pa_daemon_conf_set_log_target. Both functions look very 
similar and are one above each other, so there was still a tiny chance to mess 
up ! Sorry, sorry..
Should I resent by the way a corrected version ?

Vincent

Thanks
Vincent

Many thanks.

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/]
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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


Re: [pulseaudio-discuss] [PATCH] Log feature: Correct bad function implementation

2011-03-24 Thread Becker, VincentX
-Original Message-
From: Colin Guthrie [mailto:gm...@colin.guthr.ie]
Sent: Thursday, March 24, 2011 12:02 PM
To: General PulseAudio Discussion
Cc: Becker, VincentX
Subject: Re: [PATCH] Log feature: Correct bad function implementation

'Twas brillig, and Vincent Becker at 24/03/11 10:35 did gyre and gimble:
 Replace wrong implementation of log to file in
 pa_daemon_conf_set_log_level to pa_daemon_conf_set_log_target

Sorry but this is not based on git master (as Maarten asked for
before).

[colin@jimmy pulseaudio (master|AM)]$ cat ~/Download/pa.patch | patch
-p1 --dry-run
patching file src/daemon/daemon-conf.c
Hunk #1 FAILED at 142.
Hunk #2 FAILED at 170.
Hunk #3 succeeded at 187 (offset -5 lines).
Hunk #4 FAILED at 235.
3 out of 4 hunks FAILED -- saving rejects to file src/daemon/daemon-
conf.c.rej

I think it's just a matter of ignoring hunks 1  2 anyway (as I already
made that change when I committed the original version) and the move
from 4 to 3 should just be updated as the code in hunk 4 was updated
(tho' the newer code is the same as you put in in your hunk 3).


Sorry I am still learning with git. I thought that taking the code as-is was 
enough. I have just sent a patch back to you from master branch, and it should 
be OK, I hope.

Vin

IOW, feel free to update your patch, or alternatively, I can just commit
what I have. (straight move of the code) which I've attached. Let me
know if it's OK.


Cheers

Col

PS, kinda embarrassed I missed this glaring error first time round :D



--

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/]
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files

2011-03-24 Thread Becker, VincentX
-Original Message-
From: Maarten Bosmans [mailto:mkbosm...@gmail.com]
Sent: Wednesday, March 23, 2011 7:44 PM
To: General PulseAudio Discussion
Cc: Becker, VincentX
Subject: Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files

2011/3/21 Vincent Becker vincentx.bec...@intel.com:
 Hi,

 I recently created a new PA module (module-log-pcm) which is able to
log PCM samples from any source/sink and its corresponding
outputs/inputs. For testing audio quality, checking signal processing or   
verifying the right implementation of a sound device mixed in PA,
application fields are many.

What is the use case you are specifically interested in?

It can just be any use case that is related to audio and Pulseaudio. I am 
particulary interested to log audio before and after sound algorithms to check 
that the signal processing has been well applied (or filters).


 One just needs to give a parameter list depending on what is wished to
be logged. During the process, an audio tree, or parts of it, is probed
and logged for post-treatment purposes.

I'm sorry if I am being stuped here, but wat can the module do that
you can't with parec from a monitor source?

The module does the exact same thing as parec but parec can just log one device 
at a time but not the inputs and/or outputs.
If you wanted to log the whole set of sinks/sources connected to Pulse, you 
would need to run as many parec commands as there are devices. Not very 
practical though.
With the module you can specify a list of sinks or sources and choose to log 
the inputs or outputs, thing that is impossible now with Pulseaudio. Ok that 
needs a modification in the Pulsecore 
to probe the chunks when they are peeked or pushed but I don't see any other 
way.


 For design needs, sources and sinks are designated by ends and
source outputs/sink inputs by ports.

Why introduce the new terminology here? I think it is confusing for
people that know pulse already. Or is there perhaps some subtle
difference between the pulse concept and your designation for it?

Just to group sinks and sources under one word, same for inputs/outputs. It 
does not exist in Pulseaudio, am I right? So it shouldn't confuse anybody, I 
hope.



I am pretty sure that this module can be useful, especially when big sets of 
sinks/sources are present and someone wants to analyze an audio tree part of 
these sets during a specific use case. Why not ? May be it will create some 
needs at least..

Maarten
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files

2011-04-05 Thread Becker, VincentX
To: Maarten Bosmans; General PulseAudio Discussion
Subject: Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files
2011/3/21 Vincent Becker vincentx.bec...@intel.com:
 Hi,

 I recently created a new PA module (module-log-pcm) which is able to
log PCM samples from any source/sink and its corresponding
outputs/inputs. For testing audio quality, checking signal processing
or
verifying the right implementation of a sound device mixed in PA,
application fields are many.

What is the use case you are specifically interested in?


Hi, I just wished to relive the announcement of creating a new module dedicated 
to log PCM samples. It could be interesting to make it part of Pulseaudio.  
It can be useful at anytime and provides complementary differences with parec. 
I know it can sound 'gadget' and not properly useful but for some architectures 
containing a lot of sinks/sources, it can log actually simultaneous living 
devices. Wow, at some point it can be worth it! The advantages of this feature 
are many and if needed, I can provide a fully documented manual for it.

Vincent
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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


Re: [pulseaudio-discuss] Assertion '(size_t) decoded == a2dp-frame_length' failed at modules/bluetooth/module-bluetooth-device

2011-05-12 Thread Becker, VincentX
From: pulseaudio-discuss-boun...@mail.0pointer.de 
[mailto:pulseaudio-discuss-boun...@mail.0pointer.de] On Behalf Of 
h.pa...@accenture.com
Sent: Thursday, May 12, 2011 8:41 AM
To: pulseaudio-discuss@mail.0pointer.de
Subject: [pulseaudio-discuss] Assertion '(size_t) decoded == 
a2dp-frame_length' failed at modules/bluetooth/module-bluetooth-device

Hi All,
   I am using pulse audio 0.9.21(Tried 0.9.22 also)  on arm with 
bluez-4.89(Tried 4.93 also) but getting the following error.
   I am running pulseaudio in system mode as i am having only root user 
on my target.


~ # pulseaudio --system -n -F /etc/pulse/default.pa
W: main.c: Couldn't canonicalize binary path, cannot self execute.
W: main.c: Running in system mode, but --disallow-exit not set!
W: main.c: Running in system mode, but --disallow-module-loading not set!
N: main.c: Running in system mode, forcibly disabling SHM mode!
N: main.c: Running in system mode, forcibly disabling exit idle time!
W: main.c: Home directory of user 'root' is not '/home/mmes/op/var/run/pulse', 
ignoring.
W: main.c: OK, so you are running PA in system mode. Please note that you most 
likely shouldn't be doing that.
W: main.c: If you do it nonetheless then it's your own fault if things don't 
work as expected.
W: main.c: Please read http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode for 
an explanation why system mode is usually a bad idea.
E: module-bluetooth-device.c: Assertion '(size_t) decoded == 
a2dp-frame_length' failed at modules/bluetooth/module-bluetooth-device.c:1375, 
function a2dp_process_push(). Aborting.
Aborted
~ #


Please let me know whether it works on on system mode or its bug in pulse audio 
for arm.

You should launch pulseaudio simply under user mode or root without the -system 
option.
Pulseaudio runs on x86 and Arm. For A2DP, you are using an sbc  interface which 
is very dependant on the target as assembly instructions are used.

Are you sure you are running Pulseaudio optimized for an ARM target ?


Thanks

Patil



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Assertion '(size_t) decoded == a2dp-frame_length' failed at modules/bluetooth/module-bluetooth-device

2011-05-12 Thread Becker, VincentX
-Original Message-
From: pulseaudio-discuss-boun...@mail.0pointer.de [mailto:pulseaudio-
discuss-boun...@mail.0pointer.de] On Behalf Of Daniel Mack
Sent: Thursday, May 12, 2011 3:47 PM
To: General PulseAudio Discussion
Subject: Re: [pulseaudio-discuss] Assertion '(size_t) decoded == a2dp-
frame_length' failed at modules/bluetooth/module-bluetooth-device

On Thu, May 12, 2011 at 2:17 PM, Becker, VincentX
vincentx.bec...@intel.com wrote:

 This e-mail and any attachments may contain confidential material for
 the sole use of the intended recipient(s). Any review or distribution
 by others is strictly prohibited. If you are not the intended
 recipient, please contact the sender and delete all copies.

If that is the case, nobody on this list will be able to help you.
Your email is has already been distributed to many mailing list
archives all around the world and will be reviewed by many others. It
is yet impossible to delete all copies. Please stop adding such
idiotic footers to emails when sending messages to public lists.

I know Daniel, it is very inappropriate for an open-source public list but I 
can not remove it myself, it is added automatically by Intel's exchange server,
otherwise I would have done it since long time ago. The funniest is that Intel 
is not particulary ahead in terms of mobile handsets.

So you are in some way right : I will get and use for ex. a gmail address, like 
most of the PA forumers.

Vincent

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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