[mythtv-commits] Ticket #9282: ASF plays too fast, frontend crashes on exit

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

#9282: ASF plays too fast, frontend crashes on exit
 Reporter:  jan@…                  |           Owner:  jyavenard 
     Type:  Bug Report             |          Status:  closed    
 Priority:  major                  |       Milestone:  unknown   
Component:  MythTV - Audio Output  |         Version:  0.24-fixes
 Severity:  medium                 |      Resolution:  Fixed     
 Keywords:                         |   Ticket locked:  0         
Changes (by jyavenard):

  * status:  infoneeded_new => closed
  * resolution:  => Fixed


 (In [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,

Ticket URL: <http://svn.mythtv.org/trac/ticket/9282#comment:14>
MythTV <http://www.mythtv.org/>
MythTV Media Center

More information about the mythtv-commits mailing list