I narrowed the problem down to a pretty little program, here's the code:
varThe crash doesn't appear if either:
buf: array of Byte;
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);
BASS_ChannelSetPosition(C, 0, 0); //<-- without this line there's no crash...
BASS_ChannelGetData(C, @buf, 10000000);
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