Bug #581
oss4: fix high CPU usage (infinite loop) on pause.
100%
Description
Infinite loop in oss4 when music on pause.
History
#1 Updated by John Lindgren almost 9 years ago
It would be more helpful if you posted steps to reproduce the problem instead of a huge patch with no explanation of what it does.
#2 Updated by Dmitry Vagin almost 9 years ago
for playing music do loop { write_audio(); period_wait(); }
old code:
period_wait = poll 2 descriptors #1 pipe descriptor #2 /dev/pcm descriptor (all descriptors in nonblock mode),
on normal play = all ok, but on pause poll not wait descriptor #2 always ready for write (infinite loop).
new code:
period_wait check if paused when wait pthread_cond_wait(), and /dev/pcm descriptor in block mode (poll not need).
pipe not need it replace pthread condition.
#4 Updated by John Lindgren almost 9 years ago
Blocking mode is not an option since write_audio() needs to return immediately. So your patch will not be accepted as-is. Please post steps to reproduce the problem, so that we can work towards a viable solution.
#5 Updated by Dmitry Vagin almost 9 years ago
John Lindgren wrote:
Blocking mode is not an option since write_audio() needs to return immediately. So your patch will not be accepted as-is.
In what situations write_audio() needs to return immediately?
Please post steps to reproduce the problem, so that we can work towards a viable solution.
Pause playing music and problem reproduce.
#6 Updated by Dmitry Vagin almost 9 years ago
fd in nonblock mode
poll(fd);
write(fd);
==
fd in block mode
write(fd)
#7 Updated by Dmitry Vagin almost 9 years ago
updated patch with poll().
#8 Updated by John Lindgren almost 9 years ago
The new patch still breaks drain() because you removed poll_wake(). Read the documentation and stop making changes without understanding what was there before.
#9 Updated by John Lindgren almost 9 years ago
Dmitry Vagin wrote:
In what situations write_audio() needs to return immediately?
Always.
#10 Updated by Dmitry Vagin almost 9 years ago
John Lindgren wrote:
The new patch still breaks drain() because you removed poll_wake(). Read the documentation and stop making changes without understanding what was there before.
which documentation to read?
#11 Updated by John Lindgren almost 9 years ago
Look at libaudcore/plugin.h for starters.
#12 Updated by John Lindgren almost 9 years ago
- Category set to core
- Status changed from New to Closed
- Target version set to 3.7
- % Done changed from 0 to 100
Actually this can be fixed more cleanly in core.