BASS for WinCE

Started by Ian @ un4seen,

jhonny

Hello, I'm trying the latest version of bass.dll in my Windows Embedded 7 but it doesn't seem possible to listen to any streaming server.

To see if the problem is related to the network and not the library, I have enabled debugging messages for the wininet.dll library and tested the netradio application. It caught my attention that, although there is a connection to the streaming server (calls to InternetConnectW and HttpOpenRequestW return a handle so they are correct), the HttpSendRequestW call shows weird data after "Icy-MetaData: 1\r".

Example:
00:18:56.159 0758618e:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r???????????", 28, 0x0, 0)

This affects subsequent calls inside HttpSendRequestW, such as:
00:18:56.159 0758618e:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ", 49, 0x0, 0, 0)
00:18:56.165 0758618e:<app> 004       HttpAddRequestHeadersA(0xcc000c, "Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ", 49, 0xa0000000)
00:18:56.167 0758618e:<app> 005         wHttpAddRequestHeaders(0x38da0, 0x37fa0 ["Icy-MetaData: 1\r猊捩污瀮湐퐜䏝桔摲憎ݘ"], 49, 0xa0000000)
00:18:56.171 0758618e:<app> 006           ReplaceHeader("猊捩污瀮湐퐜䏝桔摲憎ݘ", 33, "", 0, 0, 0xa0000000)

That call to ReplaceHeader returns the next error:
00:18:56.171 0758618e:<app> 006           ReplaceHeader() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]

So, wHttpAddRequestHeaders, HttpAddRequestHeadersA and HttpWrapSendRequest return the same error and HttpSendRequestW returns FALSE.

Is bass library passing the right string and size arguments to HttpSendRequestW?

Ian @ un4seen

Oops, it looks like there's a bug in the latest/last WinCE build when custom headers aren't provided. To confirm that, please try adding a custom header and see whether it works then. For example:

stream = BASS_StreamCreateURL("http://host.com/path\r\nblah:blah\r\n", 0, 0, 0, 0);

jhonny

Quote from: Ian @ un4seenOops, it looks like there's a bug in the latest/last WinCE build when custom headers aren't provided. To confirm that, please try adding a custom header and see whether it works then. For example:

stream = BASS_StreamCreateURL("http://host.com/path\r\nblah:blah\r\n", 0, 0, 0, 0);

I've tried these three cases:

case 1: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE\r\nblah:blah\r\n", 0, 0, 0, 0);
00:01:48.663 061039fa:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\nblah:blah\r\n", 47, 0x0, 0)
00:01:48.665 061039fa:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\nblah:blah\r\n", 47, 0x0, 0, 0)
00:01:49.548 061039fa:<app> 001 HttpSendRequestW() returning TRUE

case 2: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE", 0, 0, 0, 0);
00:01:38.970 068438c2:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r??????????????????????????", 42, 0x0, 0)
00:01:38.972 068438c2:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å...", 94, 0x0, 0, 0)
00:01:38.988 068438c2:<app> 004       HttpAddRequestHeadersA(0xcc000c, "Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å...", 94, 0xa0000000)
00:01:38.991 068438c2:<app> 005         wHttpAddRequestHeaders(0x5b0f0, 0x5bb50 ["Icy-MetaData: 1\r愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪å..."], 94, 0xa0000000)
00:01:39.003 068438c2:<app> 006           ReplaceHeader("愊瑲搜い乞䵺䞎歔䞳奪䚎六倹䕭䜺䵄嚰䅔奷奪她乔䵪摔乬䕇", 78, "", 0, 0, 0xa0000000)
00:01:39.011 068438c2:<app> 006           ReplaceHeader() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.012 068438c2:<app> 005         wHttpAddRequestHeaders() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.015 068438c2:<app> 004         HttpAddRequestHeadersA() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.018 068438c2:<app> 004       HttpAddRequestHeadersA() returning FALSE
00:01:39.018 068438c2:<app> 003     HTTP_REQUEST_HANDLE_OBJECT::InitBeginSendRequest() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.021 068438c2:<app> 002     HttpWrapSendRequest() returning 12150 [ERROR_HTTP_HEADER_NOT_FOUND]
00:01:39.021 068438c2:<app> 002   HttpWrapSendRequest() returning FALSE
00:01:39.021 068438c2:<app> 001 HttpSendRequestW() returning FALSE

case 3: stream = BASS_StreamCreateURL("http://rautemusik.stream39.radiohost.de/lounge?_art=dD0xNzM4NTk3NjY4JmQ9YmEzODM0ZTAwYjYyYTNjMTdlNGE\r\n", 0, 0, 0, 0);
00:03:22.437 0789917e:<app> 001 HttpSendRequestW(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\n", 36, 0x0, 0)
00:03:22.440 0789917e:<app> 002   HttpWrapSendRequest(0xcc000c, "Icy-MetaData: 1\r\nConnection: close\r\n", 36, 0x0, 0, 0)
00:03:22.476 0789917e:<app> 003     HTTP_REQUEST_HANDLE_OBJECT::InitBeginSendRequest() returning 0 [ERROR_SUCCESS]
00:03:23.526 0789917e:<app> 002   HttpWrapSendRequest() returning TRUE
00:03:23.526 0789917e:<app> 001 HttpSendRequestW() returning TRUE

The second case is failing.

Ian @ un4seen

Ah yes, appending only "\r\n" is an even better solution, as it enables the custom headers code path without actually sending any custom headers.

I've now put an updated BASS build in the first post, which should fix the problem without needing to enable custom headers, so please re-download and see if you still have the problem with that. It's actually a BASS 2.4.17 build, so also adds support for the BASS 2.4.17 features (the previous build was 2.4.16).

jhonny

Quote from: Ian @ un4seen... so please re-download and see if you still have the problem with that.

It's working now  ;)

Aldo2026

Hi,
I've been able to play some radio stations with BASS, but the following URL is giving me trouble: http://stream03.pcradio.biz/The_Corrs-hi

VLC reports that the stream uses MPEG AAC Audio (mp4a) so I'm loading bass_aac.dll plugin. But in my attempts, I haven't been able to play the stream. Sometimes it manages to receive some metadata, but it never plays audio. And sometimes, the application simply crashes.

Could I be doing something wrong, or is it simply impossible to play this link with bass? (This link is just an example, but basically all links from pcradio.biz fail.)

Ian @ un4seen

What stack size are you using in your EXE? Note that it may need raising from the default (65536) when using the BASS_AAC add-on, so you could try that if you haven't already done so.

Aldo2026

You've found the solution. I increased the stack size from 64KB to 256KB and now it plays the stream correctly. I haven't seen that information in the BASS documentation. Thank you

Ian @ un4seen

Good to hear it was just the stack size. That issue is noted next to the BASS_AAC download in the 1st post.