Author Topic: RAM usage while streaming Audio-URL on WinCE 6.0  (Read 2142 times)

_mikey

  • Posts: 1
Hello,

we have some problems with the playback of a broadcast-stream from a local URL. BASS seems to allocate more and more RAM while doing the playback. Have a look at the following code:

Code: [Select]
chan=BASS_StreamCreateURL("http://192.168.1.28:8000/",
   0,
   BASS_STREAM_AUTOFREE|BASS_SAMPLE_MONO|BASS_STREAM_BLOCK,
   NULL,0);

do
{
DWORD progress=BASS_StreamGetFilePosition(chan,BASS_FILEPOS_BUFFER)
   *100/BASS_StreamGetFilePosition(chan,BASS_FILEPOS_END);

if (progress>75 || !BASS_StreamGetFilePosition(chan,BASS_FILEPOS_CONNECTED))
{
BASS_ChannelSetSync(chan,BASS_SYNC_END,0,&(ZTStreamClient::EndSync),0);
BASS_ChannelPlay(chan,TRUE);
}

else
{
int length = ConvertIntToString(progress).length();
this->client->SendToServer(ConvertIntToString(length).c_str(), 2);
this->client->SendToServer(ConvertIntToString(static_cast<int>(progress)).c_str(), length);
}

Sleep(15);

}while(BASS_ChannelIsActive(this->chan) != BASS_ACTIVE_STOPPED);

Initialization:

Code: [Select]
/....

BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST,1);
BASS_SetConfig(BASS_CONFIG_NET_BUFFER, 500);
BASS_SetConfig(BASS_CONFIG_NET_PREBUF,0);

At this configuration (NET_BUFFER 500, NET_PREBUF 0) BASS use continuously a growing amount of RAM. (starting @ ~198 kb till nirvana).
The interesting fact on this thing is, if i change the NET_BUFFER from 500 to 1000, memory usage will be continuously the same.

Why BASS does that scary things? Any explanation?
Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: RAM usage while streaming Audio-URL on WinCE 6.0
« Reply #1 on: 9 Feb '11 - 15:58 »
The BASS_StreamCreateURL call will allocate a download buffer (according to the BASS_CONFIG_NET_BUFFER setting) and that then stays the same for the life of the stream, so I'm not sure where that increasing memory usage would be coming from. To make sure it isn't from something else in your app, please see if you can reproduce the problem with the NETRADIO example.