[MPlayer-dev-eng] [PATCH] more general ao_macosx cleanup

Alexander Strange astrange at ithinksw.com
Wed Jun 29 08:48:49 CEST 2005


This patch does several things:
* Remove ao->chunk, since the system already gives us a buffer so  
it's pointless.
* Properly reuse everything when init() is called more than once  
without an uninit() (for instance, speed changing). Previously, it  
reallocated everything without disposing of the old copies, causing  
enormous resource leaks.
* Fix handling of AOCONTROL_QUERY_FORMAT; if anything ever used it,  
it wasn't returning the right result before.
* Pause the audio output when it runs out of sound in the buffer,  
instead of having it continually request more audio and get nothing.  
This reduces context switches and CPU use and all that, and has a  
very large effect on the problem with the video dropping frames at  
the very start. This approach isn't quite perfect; I can see the  
possibility of a race condition that would cause subtle popping  
sounds (from audio being paused and unpaused very rapidly), but  
haven't heard it on any test files.
* Fix some undefined behavior that only worked because malloc() was  
returning a block that was all zero.

The remaining problems I can see are:
* it doesn't find out the current speaker configuration properly, so  
surround will probably do the wrong thing (this wasn't introduced by  
my code).
* get_delay() is probably wrong now, but was also probably wrong before.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ao-macosx-leak.patch
Type: application/octet-stream
Size: 3895 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050629/a0f1f557/attachment.obj>


More information about the MPlayer-dev-eng mailing list