Author Topic: BASS for Android  (Read 428408 times)

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1450 on: 10 Sep '18 - 09:41 »
The BASS_STREAM_RESTRATE flag doesn't have any effect during stream creation (it only limits the download rate afterwards), so it was probably just coincidence if you did notice a difference.

Please also give the numerical "ctype" values, just to be sure.

Thank you.  I think I've noticed two separate issues, one of which might only be occuring in my simple test app.  I'll add some more logging to the original app to double check the stream handle after creation and the ctype.  I'll also try to repro the error in the test app again.

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1451 on: 11 Sep '18 - 11:41 »
In both success and failure case, a non-zero stream handle is returned form BASS_StreamCreateURL and BASS_ChannelGetInfo returns a value of 68353 ( MP4, 44100Hz, Stereo, 16bit).  I can then call BASS_ChannelPlay which returns true and BASS_Start also returns true.  BASS_ErrorGetCode returns BASS_OK.  No audio output is heard though.
« Last Edit: 11 Sep '18 - 11:53 by mcooper »

Ian @ un4seen

  • Administrator
  • Posts: 21130
Re: BASS for Android
« Reply #1452 on: 11 Sep '18 - 13:53 »
OK. If you monitor the BASS_ChannelGetPosition and BASS_ChannelGetLevel return values (eg. in a timer), do they show the playback position advancing and the stream having sound?

From the "ctype" value, it looks like you're currently using the BASS_AAC add-on. For comparison, what happens if you try to play the file without the BASS_AAC add-on?

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1453 on: 11 Sep '18 - 16:39 »
BASS_ChannelGetPosition is used, and it doesn't show the playback position advancing. 

I'll try adding BASS_ChannelGetLevel to see if that returns anything.

I've tested again with and without BASS_STREAM_RESTRATE and it definitely makes a difference.  When I remove it, I can't repro the issue.  When I add it back in, the problem returns.  I've also noticed the the tracks that fail to play are usually longer tracks / bigger media files.

Bass_AAC plugin is used.  I think the files don't play without it, but I can retest.

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1454 on: 12 Sep '18 - 11:25 »
BASS_ChannelGetPosition is used, and it doesn't show the playback position advancing. 

I'll try adding BASS_ChannelGetLevel to see if that returns anything.

I've tested again with and without BASS_STREAM_RESTRATE and it definitely makes a difference.  When I remove it, I can't repro the issue.  When I add it back in, the problem returns.  I've also noticed the the tracks that fail to play are usually longer tracks / bigger media files.

Bass_AAC plugin is used.  I think the files don't play without it, but I can retest.

I've also added in BASS_ChannelGetLevel which returns 0 in the failure case (and a value for streams that play).

Without the Bass_AAC plugin, BASS_StreamCreateURL returns 0 with an error of BASS_ERROR_HANDLE.

I'm rebuilding the app without BASS_STREAM_RESTRATE and extra logging.  I think the removal of that flag solves most or all of the errors.



Ian @ un4seen

  • Administrator
  • Posts: 21130
Re: BASS for Android
« Reply #1455 on: 12 Sep '18 - 17:39 »
BASS_ChannelGetPosition is used, and it doesn't show the playback position advancing. 

OK. That sounds like the stream stops early rather than playing silence. What position is it stopping at, and what does BASS_ChannelIsActive say then? Also check what BASS_StreamGetFilePosition with BASS_FILEPOS_CONNECTED says.

BASS_STREAM_RESTRATE will limit the download rate after the stream has been created, so as the problem is happening after the stream has created then it is possible that it is having some bearing. Of course, it shouldn't result in the stream ending early, so that is something that will need to be fixed in BASS_AAC if it is. The effect of BASS_STREAM_RESTRATE is determined by the BASS_CONFIG_NET_BUFFER setting and the file's bitrate. What BASS_CONFIG_NET_BUFFER setting are you using, and does increasing that prevent the problem happening?

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1456 on: 14 Sep '18 - 15:28 »
BASS_ChannelGetPosition is used, and it doesn't show the playback position advancing. 

OK. That sounds like the stream stops early rather than playing silence. What position is it stopping at, and what does BASS_ChannelIsActive say then? Also check what BASS_StreamGetFilePosition with BASS_FILEPOS_CONNECTED says.

BASS_STREAM_RESTRATE will limit the download rate after the stream has been created, so as the problem is happening after the stream has created then it is possible that it is having some bearing. Of course, it shouldn't result in the stream ending early, so that is something that will need to be fixed in BASS_AAC if it is. The effect of BASS_STREAM_RESTRATE is determined by the BASS_CONFIG_NET_BUFFER setting and the file's bitrate. What BASS_CONFIG_NET_BUFFER setting are you using, and does increasing that prevent the problem happening?

The playback doesn't start at all - position remains at 0.

BASS_StreamGetFilePosition returns 1 and BASS_ChannelIsActive returns BASS_ACTIVE_STALLED.

BASS_CONFIG_NET_BUFFER was left as the default value (5s?).  I've tried increasing to 30s and I've not been able to repro the problem with that value yet.  I'll keep testing and try some smaller values too.


Ian @ un4seen

  • Administrator
  • Posts: 21130
Re: BASS for Android
« Reply #1457 on: 14 Sep '18 - 16:18 »
BASS_StreamGetFilePosition returns 1 and BASS_ChannelIsActive returns BASS_ACTIVE_STALLED.

That indicates that playback was stalled by BASS because the decoder (BASS_AAC) isn't providing any data to play. I suspect that is happening because the decoder needs data from a later position in the file and it's waiting for the download to reach there, but that is happening very slowly due to BASS_STREAM_RESTRATE being enabled. Here's an update for you to try, which should temporarily disable BASS_STREAM_RESTRATE in that situation:

   www.un4seen.com/stuff/bass_aac-android.zip

Let me know if you still get the problem happening with that.

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1458 on: 17 Sep '18 - 11:04 »
BASS_StreamGetFilePosition returns 1 and BASS_ChannelIsActive returns BASS_ACTIVE_STALLED.

That indicates that playback was stalled by BASS because the decoder (BASS_AAC) isn't providing any data to play. I suspect that is happening because the decoder needs data from a later position in the file and it's waiting for the download to reach there, but that is happening very slowly due to BASS_STREAM_RESTRATE being enabled. Here's an update for you to try, which should temporarily disable BASS_STREAM_RESTRATE in that situation:

   www.un4seen.com/stuff/bass_aac-android.zip

Let me know if you still get the problem happening with that.

That does seem to fix the issue.  I've added back the BASS_STREAM_RESTRATE flag and have left BASS_CONFIG_NET_BUFFER as the default, and I've not yet been able to repro the issue.

Ian @ un4seen

  • Administrator
  • Posts: 21130
Re: BASS for Android
« Reply #1459 on: 17 Sep '18 - 13:48 »
That's great. I can't think of any other currently supported file formats (besides MP4) that might have this issue, but it would probably be best to have BASS handle the temporary BASS_STREAM_RESTRATE disabling anyway, just in case. So here's a BASS update for you to try:

   www.un4seen.com/stuff/bass-android-test.zip

Please see if you can reproduce the problem with that and the previous BASS_AAC version. If you don't still have the previous BASS_AAC version, I've put it back up here:

   www.un4seen.com/stuff/bass_aac-android.zip

mcooper

  • Posts: 51
Re: BASS for Android
« Reply #1460 on: 17 Sep '18 - 14:55 »
That also seems to solve the problem.  Thank you
« Last Edit: 17 Sep '18 - 15:31 by mcooper »