[mythtv-commits] mythtv commit: r27368 - in trunk/mythtv/libs by jyavenard

mythtv at cvs.mythtv.org mythtv at cvs.mythtv.org
Mon Nov 29 10:19:21 UTC 2010

      Author: jyavenard
        Date: 2010-11-29 10:19:21 +0000 (Mon, 29 Nov 2010)
New Revision: 27368
   Changeset: http://svn.mythtv.org/trac/changeset/27368


Fixes #9282. This ticket revealed massive issues with a few of the classes used with the audio framework.
- Resampler used a 32k and 128k statically allocated buffer. If the resampling ratio was greater than 4, memory corruption would occur. The resampler now uses a dynamically allocated memory buffer that is increased when required and freed when the audio class is closed.
- Float audio processing, if the samples received were greater than the statically allocated buffer (32k), memory corruption would occur. The audio float processing is now done in 32k blocks at a time that guarantee no memory overflow can occur.
- Audio upmixer uses a statically allocated buffer (8192 bytes). If the samples converted were greater than 8k, corruption would occur. The upmixer is now called iteratively 8k at a time.
- AC3 encoder uses a staticaly allocted buffer (128k). If the samples converted were greater than 128k, audio data would be loss and audio buffer would be left in an undetermine state. The AC3 encoder is now called in blocks according to how many free space exists in the AC3 encoder buffer.

All issues mentioned above are corner cases scenarios and unlikely to be experienced by the user ; typically the size of audio frames received at a given time is typically between 80 and 300 bytes. However, in theory ffmpeg can decode and provide samples of up to 190kB. In the sample provided in #9282 (WM3 audio codec), the audio framework is called with 60-90kB of samples triggering most of the bugs mentioned above. The resampler, upmixer and AC3 encoder has been in use in myth for several years, yet the issue had never been seen up to now. Now that was fun... Spent a whole week-end tracing what was going on. The ideal solution would be to change all the sub-classes so they do not work with static size buffer and be able to work with anything you throw at the,



More information about the mythtv-commits mailing list