Operating System - HP-UX
1752800 Members
5420 Online
108789 Solutions
New Discussion

Hang in ANextEvent() call for audio.

 
Ken Hunter
Advisor

Hang in ANextEvent() call for audio.

Hello all,

We're running an application on an HP J5600 running HPUX 10.20 that requires audio output. The application will run just fine for a varying length of time (from 10-15 minutes to several hours), then gets hung in a call to ANextEvent(). A backtrace in GDB shows that the program's stuck in a call to select() that never returns. From what I can tell, all the Aserver processes are still running fine, but the application just gets stuck. Here's the order of the Alib calls that we're making:

audio = AOpenAudio
ASetDefaultOutputs (audio, AMonoJackMask | AMonoLineOutMask | AMonoHeadphoneMask, NULL)
xid = APlaySStream (audio, ???)
streamSocket = socket (AF_INET, SOCK_STREAM, 0)
status = connect (streamSocket, ???)
APauseAudio (audio, xid, NULL, NULL)
ANextEvent (audio, ???) //we've selected for AETDataNeeded, AETTransPaused, and AETTransResumed. As far as I can tell, the only thing we ever get is an
//AETDataNeeded, aside from one AETTransPaused and one AETTransResumed at the very beginning.


In response to an AETTransPaused:
write (streamSocket, ???) //typically 2048 or 4096 8-bit samples at either 8 or 16 KHz. When it's 4096 samples, we don't seem to get this problem.
AResumeAudio (audio, xid, ,NULL, NULL)

In response to an AETTransResumed, our program merely generates some output on stdout.

In response to an AETDataNeeded:
write (streamSocket, ???) //typically 2048 or 4096 8-bit samples at either 8 or 16 KHz. When it's 4096 samples, we don't seem to get this problem.

Finally, in response to an external event, we sometimes reset the audio connection:
AFlushAudio (audio, xid, NULL, NULL)
AStopAudio (audio, xid, ASMThisTrans, NULL, NULL)
close (streamSocket)
xid = APlaySStream (audio, ???)
streamSocket = socket (AF_INET, SOCK_STREAM, 0)
connect (streamSocket, ???)
APauseAudio (audio, xid, NULL, NULL)
write (streamSocket, ???) //typically 2048 or 4096 8-bit samples at either 8 or 16 KHz. When it's 4096 samples, we don't seem to get this problem.
//From here, return to the loop around ANextEvent

HPUX version: 10.20

Any ideas - thoughts...???

thanks in advance,

Ken
Lead, Follow, or Get out of the Way! - USMC