[ao] Two patches for libao2
Please consider these two (Git) patches for inclusion into libao2. 1. Trivial fix 2. Make driver specific options configurable - With this patch, one can for example set ALSA's buffer_time option for all programs that use libao -- Heikki Orsila heikki.ors...@iki.fi http://www.iki.fi/shd From 19f07a23f4f9e641e9d208930a346c3642c2869b Mon Sep 17 00:00:00 2001 From: Heikki Orsila heikki.ors...@iki.fi Date: Sun, 30 Aug 2009 22:49:57 +0300 Subject: [PATCH 1/2] audio_out: Handle strdup()'s return value correctly [CORRECTIVE] --- src/audio_out.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/audio_out.c b/src/audio_out.c index 88660c0..6e39047 100644 --- a/src/audio_out.c +++ b/src/audio_out.c @@ -613,6 +613,7 @@ int ao_append_option(ao_option **options, const char *key, const char *value) op-key = strdup(key); op-value = strdup(value); + if (op-key == NULL || op-value == NULL) return 0; op-next = NULL; if ((list = *options) != NULL) { -- 1.6.1.2 From e905c74eca5c504d1665125df7a9523a685b987f Mon Sep 17 00:00:00 2001 From: Heikki Orsila heikki.ors...@iki.fi Date: Sun, 30 Aug 2009 23:46:48 +0300 Subject: [PATCH 2/2] Make driver specific options configurable --- doc/ao_open_file.html |3 ++- doc/ao_open_live.html |3 ++- doc/config.html |4 libao.conf.5 |4 src/ao_private.h |3 +++ src/audio_out.c |8 ++-- src/config.c | 32 +++- 7 files changed, 44 insertions(+), 13 deletions(-) diff --git a/doc/ao_open_file.html b/doc/ao_open_file.html index f6c3935..2a70aea 100644 --- a/doc/ao_open_file.html +++ b/doc/ao_open_file.html @@ -46,7 +46,8 @@ preexisting file will cause the function to report a failure./dd ddPointer to a struct describing the sample format. The caller retains ownership of this structure./dd dtioptions/i/dt ddA linked list of options to be passed to the driver or NULL if no options -are needed. Unsupported options are ignored./dd +are needed. If options is NULL, default values from libao.conf are used, +otherwise the defaults are ignored. Unsupported options are ignored./dd /dl h3Return Values/h3 diff --git a/doc/ao_open_live.html b/doc/ao_open_live.html index 388c7c8..8ffc709 100644 --- a/doc/ao_open_live.html +++ b/doc/ao_open_live.html @@ -40,7 +40,8 @@ ddPointer to a struct describing the sample format. The caller retains ownership of this structure./dd dtioptions/i/dt ddA linked list of options to be passed to the driver or NULL if no options -are needed. Unsupported options are ignored./dd +are needed. If options is NULL, default values from libao.conf are used, +otherwise the defaults are ignored. Unsupported options are ignored./dd /dl h3Return Values/h3 diff --git a/doc/config.html b/doc/config.html index ac580e0..5f67f24 100644 --- a/doc/config.html +++ b/doc/config.html @@ -39,6 +39,10 @@ There can be no extra spaces anywhere on the line. Comment lines begin with a /dd /dl +pAny other option will be passed for the audio driver as a +key-value pair. E.g. buffer_time=10 will set alsa driver's buffering +to 100ms./p + brbr hr noshade table border=0 width=100% diff --git a/libao.conf.5 b/libao.conf.5 index 161346f..7ec9d30 100644 --- a/libao.conf.5 +++ b/libao.conf.5 @@ -52,6 +52,10 @@ systems as well as Solaris. The alsa driver is for the 0.9.x ALSA API, whereas the alsa05 driver is for the 0.5.x API. .RE +Any other option will be passed for the audio driver as a +key-value pair. E.g. buffer_time=10 will set alsa driver's buffering +to 100ms. + .SH EXAMPLE Here is an example diff --git a/src/ao_private.h b/src/ao_private.h index 9fe382f..901593b 100644 --- a/src/ao_private.h +++ b/src/ao_private.h @@ -26,6 +26,8 @@ #ifndef __AO_PRIVATE_H__ #define __AO_PRIVATE_H__ +#include ao/ao.h + /* --- Operating System Compatibility --- */ /* @@ -61,6 +63,7 @@ typedef struct ao_config { char *default_driver; + ao_option *options; } ao_config; /* --- Functions --- */ diff --git a/src/audio_out.c b/src/audio_out.c index 6e39047..14012e4 100644 --- a/src/audio_out.c +++ b/src/audio_out.c @@ -95,7 +95,8 @@ static ao_functions *static_drivers[] = { static driver_list *driver_head = NULL; static ao_config config = { - NULL /* default_driver */ + NULL, /* default_driver */ + NULL, /* options */ }; static ao_info **info_table = NULL; @@ -501,7 +502,10 @@ static ao_device* _open_device(int driver_id, ao_sample_format *format, errno = AO_EFAIL; return NULL; /* Couldn't init internal memory */ } - + + if (options == NULL) + options = config.options; + /* Load options */ while (options != NULL) { if (!funcs-set_option(device, options-key, options-value)) { diff --git a/src/config.c b/src/config.c index
Excuse me, please.
Ladies and gentlemen, please forgive my intrusion. I had no idea that you were the developers for Ubuntu. I will withdraw now. I have no desire to waste your valuable time with my noob problems. I'm sure you all work very hard and are much smarter than me. One day Ubuntu will be something someone like me can use with more ease. Good luck. Jonathan Taylor gring...@gmail.com -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
Re: Excuse me, please.
On Thu, 2009-08-27 at 12:35 -0400, Jonathan Taylor wrote: Ladies and gentlemen, please forgive my intrusion. I had no idea that you were the developers for Ubuntu. I will withdraw now. I have no desire to waste your valuable time with my noob problems. I'm sure you all work very hard and are much smarter than me. One day Ubuntu will be something someone like me can use with more ease. Good luck. Jonathan Taylor gring...@gmail.com That's okay Jonathan, if you think Ubuntu is hard you should try Windows some day, talk about hard, man, driver hell, no easy printer installs, the list goes on and on, it really is amazingly bad. Cheers George -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss
Re: Possible regression in Karmic: valgrind echo foo has problems
On Mon, 31 Aug 2009 05:17:43 +0300, Mike Pontillo ponti...@gmail.com wrote: Hi all, I am trying to triage some strange segfaults on my Karmic system. It seems like I am seeing intermittent crashes in seemingly random programs. Last night I found a reproducible crash. After installing the 'samba' package and running 'net usershare list', it *always* crashes. I tried debugging in gdb a few times, but the backtrace wasn't consistent, and I couldn't explain the crashes. It looked like something was wrong at a lower layer. (maybe libc, the, kernel, gcc etc.) Then I installed the valgrind and libc-dbg packages and did a basic test: $ valgrind echo foo ==13186== Memcheck, a memory error detector. ==13186== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al. ==13186== Using LibVEX rev 1884, a library for dynamic binary translation. ==13186== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. ==13186== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework. ==13186== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. ==13186== For more details, rerun with: -v ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x40160F1: strlen (strlen.S:110) ==13186==by 0x4007C74: _dl_init_paths (dl-load.c:776) ==13186==by 0x4002A22: dl_main (rtld.c:1383) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x40160FC: strlen (strlen.S:115) ==13186==by 0x4007C74: _dl_init_paths (dl-load.c:776) ==13186==by 0x4002A22: dl_main (rtld.c:1383) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400AEC6: _dl_relocate_object (do-rel.h:104) ==13186==by 0x4003200: dl_main (rtld.c:2224) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400ABA3: _dl_relocate_object (do-rel.h:117) ==13186==by 0x4003200: dl_main (rtld.c:2224) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400AF39: _dl_relocate_object (do-rel.h:127) ==13186==by 0x4003200: dl_main (rtld.c:2224) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400A27E: _dl_relocate_object (do-rel.h:65) ==13186==by 0x400312E: dl_main (rtld.c:2287) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400A286: _dl_relocate_object (do-rel.h:68) ==13186==by 0x400312E: dl_main (rtld.c:2287) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) ==13186== ==13186== Conditional jump or move depends on uninitialised value(s) ==13186==at 0x400ABA3: _dl_relocate_object (do-rel.h:117) ==13186==by 0x400312E: dl_main (rtld.c:2287) ==13186==by 0x4013DED: _dl_sysdep_start (dl-sysdep.c:243) ==13186==by 0x4000C6C: _dl_start (rtld.c:328) ==13186==by 0x4000856: (within /lib/ld-2.10.1.so) foo ==13186== ==13186== ERROR SUMMARY: 13 errors from 8 contexts (suppressed: 0 from 0) ==13186== malloc/free: in use at exit: 0 bytes in 0 blocks. ==13186== malloc/free: 1,387 allocs, 1,387 frees, 64,390 bytes allocated. ==13186== For counts of detected errors, rerun with: -v ==13186== Use --track-origins=yes to see where uninitialised values come from ==13186== All heap blocks were freed -- no leaks are possible. I am seeing this on two separate systems running Karmic. On a different (Jaunty) system, the same output is as follows: $ valgrind echo foo ==13258== Memcheck, a memory error detector. ==13258== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al. ==13258== Using LibVEX rev 1884, a library for dynamic binary translation. ==13258== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks
Re: Possible regression in Karmic: valgrind echo foo has problems
On Wed, Sep 2, 2009 at 10:11 AM, Jarkko Palviainenjarkko.palviai...@gmail.com wrote: Happens to me as well. I'm not sure what's the problem with the binary package, but rebuilding it seems to help. This is what I get with the rebuilt valgrind_3.4.1-1ubuntu1_i386.deb: $ valgrind echo foo ==25041== Memcheck, a memory error detector. ==25041== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al. ==25041== Using LibVEX rev 1884, a library for dynamic binary translation. ==25041== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP. ==25041== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework. ==25041== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al. ==25041== For more details, rerun with: -v ==25041== foo ==25041== ==25041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 1) ==25041== malloc/free: in use at exit: 0 bytes in 0 blocks. ==25041== malloc/free: 1,387 allocs, 1,387 frees, 64,390 bytes allocated. ==25041== For counts of detected errors, rerun with: -v ==25041== All heap blocks were freed -- no leaks are possible. Hi Jarkko, Thank you for your response. I can confirm that rebuilding the same version of the valgrind package solves the problem for me as well. Should anything else be done to triage this? Could other packages be lurking in the repository that need to be rebuilt? Regards, Mike -- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss