Author Topic: BASS 2.4.12.6 / BASS_StreamCreateFileUser / hang / push stream / MP3 data  (Read 43 times)

axel

  • Posts: 8
Hello,
   I’d like to submit a potential issue regarding BASS_StreamCreateFileUser with "push" streams.
I’ve attached source and related log files obtained using same MP3 data but different versions of
BASS (2.4.9 vs 2.4.12.16 [I’ve already checked, same version included in Bass.Net API 2.4.12.17 “full install”])

SCENARIO
Using BASS to decode single (or miltiple) MP3 frame to PCM data

ISSUE
With BASS 2.4.9 everything simply works well, i.e.:

a) let <MP3_AUDIO_BUFFER> be the buffer contaninng one (or more) MP3 audio frames

b) let <PREBUFFER> be the result of concatenating almost 4000 bytes of data repeating <MP3_AUDIO_BUFFER>
E.G. : <MP3_AUDIO_BUFFER>(1)...<MP3_AUDIO_BUFFER>(n) until the "sum" of <MP3_AUDIO_BUFFER> length is greater than or equal to 4000

c) via BASS_StreamCreateFileUser callbacks BASS "process" <PREBUFFER> returning a valid "push" stream handle

d) call BASS_ChannelGetInfo to retrieve channel properties

e) call N (N >= 1) times BASS_ChannelGetData to "consume" <PREBUFFER> data (Last call, obviously, fail returning 0 with 2.4.9 and -1 with 2.4.11 or newer)

f) now the tricky part :
   f.1) push <MP3_AUDIO_BUFFER> in the stream via BASS_StreamPutFileData method
   f.2) retrieve decoded PCM data via BASS_ChannelGetData

g) save PCM data for further processing

h) repeat points from f) to g) until some event occur

Above "procedure" fails using BASS 2.4.12.6; same code hangs (literally) on point c) (BASS_StreamCreateFileUser call).

ISSUE RELATED DATA (in attached file)
- please see file "BASSPushTest_2017.12.13_BASS_2.4.9_no_problems_at_all.log" to verify the behaviour of BASS 2.4.9
- please see file "BASSPushTest_2017.12.13_BASS_2.4.12.16_hang_on_BASS_StreamCreateFileUser.log" to see the new behaviour of BASS 2.4.12.6

Many thanks in advance,
Axel

P.S.
Topic related to previous (and resolved) http://www.un4seen.com/forum/?topic=17186.0

Ian @ un4seen

  • Administrator
  • Posts: 20433
It appears to be getting stuck in your FILEREADPROC callback function. That call isn't showing in your log, so I guess it must be the logging that's getting stuck. Perhaps the logging has to synchronize with the main thread due to the listbox, but the main thread is busy (in the BASS_StreamCreateFileUser call), resulting in a deadlock? What happens if you only log to the file?

axel

  • Posts: 8
Tried disabling log to listbox but same result (BASS_StreamCreateFileUser "hang").
If you try to "reference" BASS 2.4.9 logging take place either on listbox than file.
I've attached executable compiled against BASS 2.4.9 to let you "double check" my assert.

Thank you very much,
   Axel

Ian @ un4seen

  • Administrator
  • Posts: 20433
Are you sure the problem still happens without the listbox? If so, please send that EXE to investigate with.

The reason the problem is not happening with the old BASS version is because it used less data to verify MP3 data (as in your linked thread). Later BASS versions check more data to reduce false positives (non-MP3 data detected as MP3). The MP3 detection is failing with your data in this case, and so BASS tries Media Foundation codecs. Media Foundation reads from another thread, hence the deadlock with the listbox logging in your FILEREADPROC function. If wanted, you can disable Media Foundation via the BASS_CONFIG_MF_DISABLE option:

Code: [Select]
BASS_SetConfig(BASS_CONFIG_MF_DISABLE, 1);
« Last Edit: 13 Dec '17 - 16:40 by Ian @ un4seen »

axel

  • Posts: 8
Many thanks Ian, I'll try BASS_SetConfig as soon as possibile !

Meanwhile I've attached EXE with NO log at all; actually I've replaced
log calls with VB System.Diagnostics.Debug.Print and "intercepted"
related output by mean of DbgView (please see ASVAIO12.log file).

I Hope this helps you,
   Axel

axel

  • Posts: 8
Sorry Ian, I can't find BASS_CONFIG_MF_DISABLE in Bass.Net 2.4.12.6.
Could you tell me the literal value so I can complete the test ?

Many thanks in advance,
   Axel

axel

  • Posts: 8
I've found a possible value (0x28) from here ( http://kyaa.sg.archive.tjw.moe/dfqnft.h ).
This time BASS_StreamCreateFileUser fails (return value -1) with error code 41 (BASS_ERROR_FILEFORM).
You were right (obviously); now, is it possible (e.g. by mean of BASS_SetConfig) to "force" MP3 detection ?

BR,
   Axel