22 May '13 - 07:06 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: BASS_ChannelGetData crash with .m4a file (attached inside + test program)  (Read 528 times)
fmcoder
Posts: 386


« on: 3 Jul '12 - 12:08 »
Reply with quoteQuote

I narrowed the problem down to a pretty little program, here's the code:
var
  C: HCHANNEL;
  buf: array of Byte;
  D: String;
begin
  D := ExtractFilePath(ParamStr(0)); //get the executable path
  BASS_Init(0, 44100, 0, Handle, nil);
  BASS_PluginLoad(PChar(D + 'bass_aac.dll'), BASS_UNICODE); //<-- without this line there's no crash...
  C := BASS_StreamCreateFile(False, PChar(D + 'Billy Ocean - Loverboy.m4a'), 0, 0, BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT or BASS_UNICODE);
  SetLength(buf, 10000000);
  BASS_ChannelSetPosition(C, 0, 0); //<-- without this line there's no crash...
  BASS_ChannelGetData(C, @buf[0], 10000000);
end;

The crash doesn't appear if either:

1) BASS_PluginLoad line is commented out and the channel is created without using plugins. This pops up a question: how does BASS opens an m4a file without plugins? (the BASS_ChannelInfo returns "0" in the plugin field to confirm it). When the file is handled by BASS, there's no crash and file plays fine. Probably a good solution will be to give BASS a priority when creating streams, eg. try plugins only if BASS was unable to open the file.

2) BASS_ChannelSetPosition line is commented out. It doesn't crash if position is set to 100000 or more, but crashes for values under 10000 (approx.).

Here's the program and test mp4 file: http://www.djsoft.net/crash.rar
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #1 on: 3 Jul '12 - 17:12 »
Reply with quoteQuote

This looks like it may be something that's sorted in the latest stuff...

   www.un4seen.com/stuff/bass_aac.dll

Please give that a try and let me know if the problem still occurs.

Regarding decoder priority, BASS's built-in decoders do have priority over plugins, but BASS doesn't actually include built-in support for MP4 files. It can use Media Foundation codecs to decode MP4 files (on Windows 7 and updated Vista), and they have the lowest priority, ie. the order of priority is: built-in decoders, plugins, Media Foundation codecs. So BASS_AAC will be used if loaded (via BASS_PluginLoad), otherwise the Media Foundation codec will (if available).
Logged
fmcoder
Posts: 386


« Reply #2 on: 3 Jul '12 - 18:53 »
Reply with quoteQuote

Yes, it works Smiley

Thanks!
Logged
Ian @ un4seen
Administrator
Posts: 15259


« Reply #3 on: 4 Jul '12 - 17:18 »
Reply with quoteQuote

Jolly good.

The BASS_AAC update is now up on the BASS webpage. Besides the fix for MP4 files such as the one above, the built-in MP4 tag (BASS_TAG_MP4) support has also been removed from the Windows version, as BASS (since 2.4.8) itself does include built-in MP4 tag support on Windows (it's needed for the Media Foundation codec).
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines