Author Topic: Iternet radio crashes when stream bit rate changes  (Read 695 times)

MagratG

  • Posts: 2
I have built a small Internet radio player using VB.Net that works very well except that one stream, my favourite, causes BASS to cause a BASSSync.BASS_SYNC_END whenever the stream frequency changes.  It gives BASSError.BASS_ERROR_UNKNOWN as the reason for the crash.  The only way to recover is to restart the stream again, but then the sound repeats the last few seconds gradually reducing until it gets to the new bit as though a buffer is emptying! 
This is the problem stream: "http://deliciousagony.streamguys1.com:80/live".
I've tried trapping other errors but the 'SYNC_END' seems to the only one that catches it.
The stream frequency is mostly 44.1K but some tracks are 48K with announcements at 24K or 32K.
Since it doesn't crash very often it's taken a long time to work out what seems to be happening!
Any suggestions gratefully received!

Edit: the stream frequency is from TAG_INFO - channelinfo.freq.  The stream bitrate is always 128K.
« Last Edit: 3 Nov '23 - 20:26 by MagratG »

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Iternet radio crashes when stream bit rate changes
« Reply #1 on: 6 Nov '23 - 14:44 »
Is the app actually crashing or is playback just stopping? Sample rate changes in streams aren't supported (bitrate changes are fine though), so BASS will indeed end the stream when it detects that. The only thing you can do currently is reconnect to create a new stream for the new data with the new sample rate, like you already are.

It really isn't a good idea for the sample rate to change mid-stream, and other software (not only BASS) will also have issues with that. If you can contact the stream's owner, perhaps you could suggest that they resample everything to a consistent sample rate?

MagratG

  • Posts: 2
Re: Iternet radio crashes when stream bit rate changes
« Reply #2 on: 9 Nov '23 - 18:41 »
Yes,  other software has trouble with this stream!  I've used a VLC wrapper library for quite a while restarting it manually when it stopped but thought I'd try some more up-to-date libraries.  I think it was an nAudio sample app that included data rates etc. that made me realise what was probably causing the error.  I had thought that there was just a break in the stream which stopped playback.
As least BASS gives me an automatic reconnect!
Maybe a specific Sync_Error could be added in a future update for when the sample-rate changes!
Thanks.
P.S. one of the main reasons I opted to use this BASS wrapper was the extensive documentation on how to use it.  Excellent job there!

MB_SOFT

  • Posts: 496
Re: Iternet radio crashes when stream bit rate changes
« Reply #3 on: 9 Nov '23 - 22:36 »
BASS is the best. I still don't undesrtand why some developers still use other libraries that miss most of the features of bass. with BASS you become the owner of the audio samples in your device. I started using BASS on 2001 and i will die with it  :)