[MPlayer-dev-eng] [PATCH] [TEST ONLY] Let ao_macosx use best chunk_size.

Ulion ulion2002 at gmail.com
Fri Nov 2 04:41:07 CET 2007


Hello,

This patch is for bug http://bugzilla.mplayerhq.hu/show_bug.cgi?id=706
, for test only, already tested on 10.4 and 10.5 max os, now need some
10.3 test. If you have 10.3 mac machine and can build mplayer from
svn, try this patch, and give response here.

This patch is for test, it add some print message for theRenderProc
requested bytes size, the best chunk_size should equal to this value.
The chunk_size can be calculated by:
ao->chunk_size =
ceil(maxFrames*inDesc.mSampleRate/devSampleRate)*inDesc.mBytesPerFrame;
Here maxFrames coms from kAudioDevicePropertyBufferFrameSize,
devSampleRate comes from kAudioDevicePropertyNominalSampleRate, which
can be set in the osx 'Audio MIDI Setup' in the
/Applications/Utilities directory.
If the source audio's sample rate is not same with the output
device's, the AudioUnit will do some resample for it, we can calculate
the best chunk_size we should use by the input sample rate and output
sample rate.
The result value of chunk_size, will be exactly the value
theRenderProc requested if the ceil does nothing, such like input
96kHz and output 32kHz or 48kHz. But if ceil did the round work for
the chunk_size, such like input 44.1kHz, output 48kHz or reversed, the
bytes theRenderProc requested will not be exactly the same value, it
changes after every several requests, that's why the test patch print
4 times request byte size. This is correct and expected behavior, we
couldn't do it better than this.

Indeed, even the chunk_size is wrong, the audio output will not have
big trouble, it probably still works, but just a little worse
performance than the best chunk_size which you even can not feel.
But, since the bug report said on 10.3 the audio has problem with the
old code, please try this on your 10.3 machine, and if it works, and
if theRenderProc report the same byte size as the M value in 'AO:
[macosx] using    N chunks of M bytes (buffer len Z bytes)', this
patch will be worth to apply to resolve that bug.

To see the reported byte size from theRenderProc, add '-v' to your
mplayer comandline.

-- 
Ulion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osx_au_chunk_size_fix.diff
Type: text/x-diff
Size: 1901 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20071102/279ab477/attachment.diff>


More information about the MPlayer-dev-eng mailing list