From: James S. <jst...@us...> - 2003-05-23 18:05:36
|
Hi, Just resurrecting a really old thread as I've randomly thought of a better way to do it. The original problem was that the audio out driver could be closed while silence was being outputted to fill a gap. I worked around this by adding a if(driver->open) before every write in ao_fill_gap. The attached patch changes the waiting for an empty fifo so that it actually waits until the audio loop is blocked on the empty fifo rather than the fifo being empty. This means that these checks are unnecessary as the driver isn't closed until the gap fill has finished. I guess there is still a race between the closing of the driver and another buffer being added to the fifo, but that's another problem entirely. Opinions? James. On Wednesday 23 Apr 2003 12:48, James Courtier-Dutton wrote: > James Stembridge wrote: > >On Sunday 20 Apr 2003 16:38, Manfred Tremmel wrote: > >>Sorry James, my fault, the patch fixes the problem! The audio_out.c file > >>changed between your mail and my test, so I had to add it by hand. I've > >>included it in write_pause_burst() function and not in ao_fill_gap(). > >>Looks very similary to me. > >>Now I've done a gdb backtrace (first time I've used gdb) and I've seen > > > >What I'm wondering is if the other driver->write calls in ao_fill_gap and > >write_pause_burst should also be preceded by a check to see if the driver > > is still open. Evidently these functions can be inside their loops when > > the driver is closed, so I think they probably should. > > > >Anyone see any good reason why not? > > > >James. > > I think these patches are wrong. The driver should never be closed > before the audio_out loop has finished. > So I think that the correct approach would be to fix the driver closing > function call to shut down the audio out thread correctly before the > driver is closed, and not just hide the problem. > > Cheers > James |