Author Topic: BASS for Android  (Read 478981 times)

kenumir

  • Posts: 15
Re: BASS for Android
« Reply #1425 on: 18 Jul '18 - 13:59 »
Problem with null pointer exception when init BASS:
Code: [Select]
java.lang.NullPointerException: Attempt to invoke interface method 'int com.android.internal.app.IAppOpsService.checkAudioOperation(int, int, int, java.lang.String)' on a null object reference
        at android.media.AudioTrack.isRestricted(AudioTrack.java:1602)
        at android.media.AudioTrack.play(AudioTrack.java:1580)
        at com.un4seen.bass.BASS.BASS_Init(BASS.java:-2)

Latest version from forum.

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1426 on: 18 Jul '18 - 15:49 »
Please post your BASS_Init call, and also confirm what Android version you're running on and/or if you've reproduced the problem on multiple devices.

kenumir

  • Posts: 15
Re: BASS for Android
« Reply #1427 on: 18 Jul '18 - 22:20 »
Device:
Code: [Select]
Huawei Mate 8 (HUAWEI NXT-L09)
Android 6.0

Init:
Code: [Select]
BASS.BASS_Init(-1, 44100, BASS.BASS_DEVICE_FREQ | BASS.BASS_DEVICE_16BITS | BASS.BASS_DEVICE_AUDIOTRACK)
Cannot reproduce this on my devices. Came from bug report system. For now only once.

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1428 on: 19 Jul '18 - 15:46 »
OK. It looks like the problem happened inside an AudioTrack.play call so I've added a check to that, which should catch the exception and have the BASS_Init call fail (with BASS_ERROR_UNKNOWN) instead. The BASS update is in the 1st post. Let me know if you see the problem happen again with that.

jnyang

  • Guest
Re: BASS for Android
« Reply #1429 on: 29 Jul '18 - 08:24 »
Hi, Ian.

I am currently trying to update the BASS library of my Android app to use the capability of Android's built-in codecs like AAC.
However, it seems that the BASS library crashes (signal 11 (SIGSEGV)) when opening M4A files with enabling floating-point sampling like the followings:

Code: [Select]
BASS.BASS_StreamCreateFile('/path/to/file/file.m4a, 0, 0, BASS.BASS_SAMPLE_LOOP|BASS.BASS_SAMPLE_FLOAT)
It is tested with the "fxtest" sample code on various Android devices, e.g., Samsung Galaxy A8 (2018), and all the test devices I have crashed.
Without the "BASS_SAMPLE_FLOAT" flag, the app plays the file without any errors.

Could you check whether it is a bug of the BASS library or not?
Thanks in advance for your help. :D

otherside

  • Posts: 35
Re: BASS for Android
« Reply #1430 on: 31 Jul '18 - 11:50 »
Hello.
I got reports from users that a crash happens in BASS_MusicLoad().
Can you please return 0 instead of native expection? Because it is impossible to handle, app crashes. I cannot reproduce it, unfortunately.
« Last Edit: 31 Jul '18 - 12:51 by otherside »

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1431 on: 31 Jul '18 - 14:41 »
I am currently trying to update the BASS library of my Android app to use the capability of Android's built-in codecs like AAC.
However, it seems that the BASS library crashes (signal 11 (SIGSEGV)) when opening M4A files with enabling floating-point sampling like the followings:

Code: [Select]
BASS.BASS_StreamCreateFile('/path/to/file/file.m4a, 0, 0, BASS.BASS_SAMPLE_LOOP|BASS.BASS_SAMPLE_FLOAT)
It is tested with the "fxtest" sample code on various Android devices, e.g., Samsung Galaxy A8 (2018), and all the test devices I have crashed.
Without the "BASS_SAMPLE_FLOAT" flag, the app plays the file without any errors.

Oops! Here's an update that should fix that:

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

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

I got reports from users that a crash happens in BASS_MusicLoad().
Can you please return 0 instead of native expection? Because it is impossible to handle, app crashes. I cannot reproduce it, unfortunately.

If you have got crash logs, please post one to have a look at. If not, are you using some other logging to confirm that it is crashing in a BASS_MusicLoad call? Also, do you know what files the users were trying to load, and if so, can you get them from the users?

jnyang

  • Guest
Re: BASS for Android
« Reply #1432 on: 1 Aug '18 - 00:04 »
Oops! Here's an update that should fix that:

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

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

Now it works without any errors. Thanks, Ian!  :)

otherside

  • Posts: 35
Re: BASS for Android
« Reply #1433 on: 1 Aug '18 - 09:08 »
h the "fxtest" sample code on various Android devices, e.g., Samsung Galaxy A8
If you have got crash logs, please post one to have a look at. If not, are you using some other logging to confirm that it is crashing in a BASS_MusicLoad call? Also, do you know what files the users were trying to load, and if so, can you get them from the users?

Here's log
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.mp3.player <<<

backtrace:
  #00  pc 0000000000022aa4  /data/app/com.mp3.player-1/lib/arm/libbass.so (BASS_MusicLoad+219)
  #01  pc 0000000000d0e0bb  /data/app/com.mp3.player-1/oat/arm/base.odex

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1434 on: 1 Aug '18 - 14:00 »
Now it works without any errors. Thanks, Ian!  :)

Great! The BASS update is now up in the 1st post.

Here's log
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.mp3.player <<<

backtrace:
  #00  pc 0000000000022aa4  /data/app/com.mp3.player-1/lib/arm/libbass.so (BASS_MusicLoad+219)
  #01  pc 0000000000d0e0bb  /data/app/com.mp3.player-1/oat/arm/base.odex

Please post the signal/code info and registers (r0/etc) from the crash log too, and confirm what BASS version was used (use BASS_GetVersion to check that).

otherside

  • Posts: 35
Re: BASS for Android
« Reply #1435 on: 2 Aug '18 - 11:39 »
Please post the signal/code info and registers (r0/etc) from the crash log too, and confirm what BASS version was used (use BASS_GetVersion to check that).
Unfortunately the message above is the only I have.
bass version = 33819916, bassFx version = 33819649

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1436 on: 2 Aug '18 - 15:01 »
OK. From that, I see where the crash happened but unfortunately not why it happened. Are you in contact with any affected users? If so, can you ask them to send you a file that the crash happened with, and also confirm if the crash happens every time that they try to play that file?

Pompom

  • Guest
Re: BASS for Android
« Reply #1437 on: 24 Aug '18 - 14:37 »
Hi !

I'm trying to use the latest version of BASS for Android in my free application. I have to admit, this library is a MUST.
All was working fine until the latest version came out (1st Aug 18), and the problem I'm facing is pretty dark...

My application can make a call of the following line more than once in a second :

Code: [Select]
BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_BLOCK | BASS.BASS_STREAM_AUTOFREE, null, request);
Randomly, this line makes its execution thread stops. In older versions of BASS, the thread was restarted.
But in the latest, it is not. Even when putting mutliple threads, BASS is killing them one by one after some iterations.

I would love to update BASS to its latest version.

Thanks for the help ! :)

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1438 on: 24 Aug '18 - 15:49 »
Did you only change the libbass.so files (and nothing else) before the problem began, and does switching back to the older version now stop the problem happening? You could also try this latest build:

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

If the problem still happens with that, are there any messages in the Logcat window when it happens? Please also see if you can reproduce it with the NETRADIO example that's included in the Android BASS package, eg. by rapidly tapping the preset buttons. A pre-compiled version of that is available here:

   www.un4seen.com/stuff/netradio.apk

otherside

  • Posts: 35
Re: BASS for Android
« Reply #1439 on: 25 Aug '18 - 19:35 »
Hi !

I'm trying to use the latest version of BASS for Android in my free application. I have to admit, this library is a MUST.
All was working fine until the latest version came out (1st Aug 18), and the problem I'm facing is pretty dark...

My application can make a call of the following line more than once in a second :

Code: [Select]
BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_BLOCK | BASS.BASS_STREAM_AUTOFREE, null, request);
Randomly, this line makes its execution thread stops. In older versions of BASS, the thread was restarted.
But in the latest, it is not. Even when putting mutliple threads, BASS is killing them one by one after some iterations.

I would love to update BASS to its latest version.

Thanks for the help ! :)

I can confirm that there's a strange bug in the last version. In my case playback from internet didn't work or stucked (users told me). But I didn't write about it, since I don't have logs.

teq

  • Posts: 26
Re: BASS for Android
« Reply #1440 on: 30 Aug '18 - 15:06 »
Hi there! I need to instant play track, but cache it after loading. Is it possible using BASS_StreamCreateURL ? And if not, how i can achive this?

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1441 on: 30 Aug '18 - 16:15 »
I can confirm that there's a strange bug in the last version. In my case playback from internet didn't work or stucked (users told me). But I didn't write about it, since I don't have logs.

Is the problem that a BASS_StreamCreateURL call isn't returning? Did the user(s) have the problem with a particular URL and can they reproduce it? What was the last BASS version number that you used and didn't have the problem with?

Hi there! I need to instant play track, but cache it after loading. Is it possible using BASS_StreamCreateURL ? And if not, how i can achive this?

Do you want to save the file locally while it is being downloaded and played by BASS? If so, that is possible by using a DOWNLOADPROC callback function, which you include in the BASS_StreamCreateURL call. An example code snippet can be found in the DOWNLOADPROC documentation (will need modification for Android APIs).

teq

  • Posts: 26
Re: BASS for Android
« Reply #1442 on: 30 Aug '18 - 16:54 »
Hi there! I need to instant play track, but cache it after loading. Is it possible using BASS_StreamCreateURL ? And if not, how i can achive this?

Do you want to save the file locally while it is being downloaded and played by BASS? If so, that is possible by using a DOWNLOADPROC callback function, which you include in the BASS_StreamCreateURL call. An example code snippet can be found in the DOWNLOADPROC documentation (will need modification for Android APIs).

Thanks. Will it work if i am using BASSFlag.BASS_STREAM_DECODE, and then BASS_FX_TempoCreate ?

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1443 on: 30 Aug '18 - 17:08 »
Yes, your DOWNLOADPROC function will be called as the data is downloaded, which could be during playback or just decoding (when using BASS_STREAM_DECODE).

Ryota

  • Posts: 18
Re: BASS for Android
« Reply #1444 on: 6 Sep '18 - 06:22 »
Hi Ian,

When I set 1 to BASS_CONFIG_FLOATDSP, processing of encoding to MP3 with using BASSenc_MP3 does not work.

Is this a standard specification?

Here is the code excerpted.

Code: [Select]
BASS.BASS_SetConfig(BASS.BASS_CONFIG_FLOATDSP, 1);

Code: [Select]
int hEncode = BASSenc_MP3.BASS_Encode_MP3_StartFile(hTempStream, "", 0, strPath);

Regards,
Ryota.

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1445 on: 6 Sep '18 - 16:36 »
Oops! You're right, BASSenc_MP3 does indeed have a problem when the BASS_CONFIG_FLOATDSP option is enabled (and BASS_SAMPLE_FLOAT isn't used). Here's an update that should fix the problem:

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

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

mcooper

  • Posts: 53
Re: BASS for Android
« Reply #1446 on: 7 Sep '18 - 11:49 »
I'm having a problem with some streams not playing in a Xamarin Android app.  Its inconsistent though, one particular media file almost never plays but does very rarely.  The media uris are time limited and signed, so they vary each time, and I think the issue might be related to the uri. If I download the media file and copy it to dropbox, then try to play from a dropbox uri - it works every time, so the media itself is ok.

Most of the code is shared with a Xamarin iOS app and that always works.

I've tried to create a very simple Xamarin Android app to repro this:

            stream = Bass.BASS_StreamCreateURL(uri, 0, BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
            var result = Bass.BASS_ChannelPlay(stream, true);
            var error = Bass.BASS_ErrorGetCode();
            Bass.BASS_Start();

uri would be something like "https://d1lsokuf27tvj3.cloudfront.net/24875435110808102/00094632150257/00094632150257_T18_audtrk.mp4?Expires=1536320619&Signature=FlBmez5-WqLPUXqB7wRq20r0TqdD2D7y0LMgBlU7FybHuKg5JLmjewF08YDlzDo0bc0pWNufxOqhoKLSmeUogW4T2CeCkTV8Yc-R~gTPZ2r9j3xPrvBkDqPbmtYUIw3qSEw6KfhCbcNCbUm8tXrzQ9MB7v0UB7FzRJFSo86LLNSE8AtgbK54aNmI2RA9~XQQTICKftssVyXyJEzWPzr6L6o6l7DDck9j6GSFBhYoDPqrnT~rYh2UDHfUEj2bQTz6o6EdOxD8ffkfDsHZn58gZNi02caKcqKvUZTHBDvRR5dazmY4bRhZ9b5u6OplE~bLZGsW4y8l9GLyZs5BmtJ7zA__&Key-Pair-Id=APKAIWI3IS7N67XKLDYQ" but that will expire and return a 403 error soon

When it fails, a valid (non-zero) stream handle is returned and there is no error code either, just no audio output.

I've also tried to create an identical native android app, and can't repro the issue there either

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1447 on: 7 Sep '18 - 14:37 »
What is the file format? Please also check the BASS stream's "ctype" value (which you can get with BASS_ChannelGetInfo) both when the stream works and when there's no sound.

mcooper

  • Posts: 53
Re: BASS for Android
« Reply #1448 on: 7 Sep '18 - 16:04 »
The media is AAC+ / MP4.  cytype returns: {MP4, 44100Hz, Stereo, 16bit} in the success case.  I can't get a failure case right now, but I'll keep trying.  I'm using the aac plugin, but noticed in a native android app that doesn't seem to be required.  The audio plays with or without it.

The original app where I noticed this issue was using BASSFlag.BASS_STREAM_RESTRATE which definitely increases the failure rate so I've removed that.  The basic sample app I was using to test never used this flag though.

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android
« Reply #1449 on: 7 Sep '18 - 16:40 »
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.