[Pianod] Music doesn't start when launched at startup
pi.gonewest at xoxy.net
pi.gonewest at xoxy.net
Tue May 7 07:16:57 PDT 2013
Hi Perette, actually I tried that change last night but it had no effect. Pianod continues to start in some inconsistent state, giving me internal error 500 whenever I ask to play a station. Stopping and starting the pianod service always fixes this.
I tried adding an early ao_default_driver_id() test up in main(). In pseudo code what I added was something like:
ao_initialize();
x = ao_default_driver_id();
while (x<0) {
print failure message
sleep a bit
x = ao_default_driver_id();
}
On the theory that I could just wait until the default device was available. But this code didn't make any difference.
I implemented a command "reset audio" with the idea that, if the audio is in some inconsistent state I could use this command to manually reset, eg
ao_shutdown();
ao_initialize();
But this didn't work either.
One thing I cannot figure out is how to redirect stderr and stdio to a file in that init.d script... A little help on that would be much appreciated and probably help everyone involved. Thanks!
On May 7, 2013, at 5:19 AM, "Perette Barella - perette at barella.org" wrote:
> Hi guys,
>
> You're right about the ao_default_driver_id.
> if (audioOutDriver < 0) {
> audioOutDriver = ao_default_driver_id();
> + if (audioOutDriver < 0) {
> + BarUiMsg (player->settings, MSG_ERR, "No audio driver available\n");
> + return NULL;
> + }
> }
>
>
> But if taking the play out of the startscript didn't work for GoneWest, there must be something more. Is it dropping a core? If you ./configure --enable-debug, it compiles with -g and you should get core dumps suitable for loading into GDB to find out exactly where it's dying.
>
> Perette
>
>
> On 2013年05月07日, at 1:00, pi.gonewest at xoxy.net wrote:
>
>>
>> Chinasaur and I have been discussing this same issue on the Raspberry Pi forums. (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=35&t=37494&p=344130#p344130)
>>
>> In my case if I setup pianod to play immediately upon launching it fails, but if I immediately restart the service without changing anything else playback works fine. My thought is the daemon is trying to play before the audio driver is completely ready.
>>
>> So I'm going to try two things:
>>
>> (1) remove the "play" command from my startscript. Looks to me like pianod doesn't try opening a playback channel until it needs to play a song, so if I boot with pianod in an idle state then I can choose how long to wait before selecting a station.
>>
>> (2) change the player logic. BarPlayerOpenAudioOut(). The function calls
>>
>> if (audioOutDriver < 0) {
>> audioOutDriver = ao_default_driver_id();
>> }
>>
>> but according to the libao documentation, ao_default_driver_id() can return -1 if there is no usable audio output device. There's some logic that assumes it's possible to fall back to a "default" device but in my case I'm already using the default. I want to see if there's some way to detect this case and fail more gracefully, e.g. pause and retry or something along those lines.
>>
>>
>>
>> _______________________________________________
>> Pianod mailing list
>> Pianod at lists.deviousfish.com
>> http://lists.deviousfish.com/listinfo.cgi/pianod-deviousfish.com
>
> _______________________________________________
> Pianod mailing list
> Pianod at lists.deviousfish.com
> http://lists.deviousfish.com/listinfo.cgi/pianod-deviousfish.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deviousfish.com/pipermail/pianod-deviousfish.com/attachments/20130507/1e30f63e/attachment-0003.htm>
More information about the Pianod
mailing list