PDA

View Full Version : Couple of Android/FiiO issues (library, playback)



annoyingmouse
May 17th, 2017, 05:32 PM
I'm using foobar for android on the fiio x5 3rd gen and although for the most part it is working fine, I am having a couple of issues.


Since the upgrade to 1.0.71, library indexing has slowed down dramatically. At the moment, my library has 36475 tracks. On 1.0.63, this takes less than ten minutes to index (which is pretty impressive) but on the upgrade it gave up after about 40 minutes and ~22000 tracks. Reverting to the earlier version has solved the problem but is obviously not ideal.
Although it isn't happening every time, after the majority of albums finish I'm having an issue whereby when I select another track/album playback doesn't work properly. Instead of playing as expected, there is no audio and the selected track will appear to fast forward or play at an increased speed (not really sure how to describe it other than to say imagine the track is playing at about 30 seconds per second)
Probably a device specific problem but the physical play/pause button will pause correctly every time but sometimes when re-pressing to play again it will restart the current track. If I press play using the touchscreen it plays correctly. Outside this issue the buttons seem to work fine but if it helps, when I tried Poweramp on the device, the buttons only worked properly when I setup wired headset buttons to "single press (fast)"


Other than this, I really like the app. I can't find any other app that works on the device that comes close to matching the variety of library browsing options in foobar.

Obviously I understand that these could be hardware issues but it would great if anyone could help anyway.

Peter
May 18th, 2017, 04:45 AM
Thanks for the problem reports.

The slow indexing is inflicted by Android's Storage Access Framework (SAF) used to access external storage in the new version.
You can go around it (but you will lose write access) by going to advanced settings, toggling "use old folder picker", removing library folder and adding it back.

annoyingmouse
May 18th, 2017, 04:09 PM
Thanks. That worked.

I should have mentioned on the second problem that the only way to get music to play properly again is to completely close foobar and then reopen it.

Peter
May 19th, 2017, 06:20 AM
The second issue-
Did you by any chance flip the 'Use OpenSL' toggle in Advanced?
Whatever its state is, please try the opposite mode.

For reference, OpenSL is known to be unreliable for music playback on many devices and cannot be enabled by default, but it may help if the default output mode (Android AudioTrack) is behaving incorrectly - at least it avoids piping all your sound thru Java code.

annoyingmouse
May 22nd, 2017, 03:20 PM
That does appear to have fixed to the second problem. Thanks.

Peter
May 24th, 2017, 08:06 AM
Which way does it work properly for you, OpenSL disabled or enabled?

annoyingmouse
May 24th, 2017, 03:44 PM
Enabled

annoyingmouse
June 8th, 2017, 12:30 PM
Hi again,

I happened to spot on the dev blog entry that the "old folder picker" option shouldn't be needed again after 1.0.78 so after updating to 1.0.79 I decided to give it a go again, turned the option off and had the same problem as I described above with the library indexing getting stuck this time at ~27000 tracks after about 45 minutes. Turned the old folder picker back on and it's still working quickly and correctly. Not sure if I've misinterpreted the dev blog but I thought I'd mention it in case I hadn't.

Also, I think I've noticed a pattern on the third problem from my original post with the play/pause button. I can't say for certain if it was the same in the previous version but it appears that the issue is only happening with files on the second sd card. To be clear the device has two sd cards. Using the old folder picker option the first sd is added to Music Folders as the "External Storage" option and the second is a manual path of "/mnt/external_sd2". When songs on the first card are paused they resume without issue. Songs on the second SD seem to bring the screen back on, play for a second then the lock screen notification briefly disappears (like the app is restarting), reappears and then the track starts from the beginning.

annoyingmouse
June 10th, 2017, 07:26 AM
On this play/pause error again, I've just had a look at the console after what I described above as "like the app restarting" and it does indeed appear that the app is restarting.

I've also noticed, once more only on the manual path card, that sometimes when I try to restart playback it won't restart at all, even from the start and when I try to select any other track it won't work. I've tried closing the app and force stopping the app but the only solution that works in this situation is restarting the device. Not sure if it's true for both issues but certainly on this one when I look at the console I'm seeing a message "Playback error: Access Denied".

I've tried swapping the cards over and the issues are only happening on the manual path card which suggests to me that it isn't an issue with the actual sd cards

Peter
June 13th, 2017, 05:15 AM
Just a heads-up: I have a FiiO x5 3gen unit now and have been able to recreate some of these bugs already. The next update will deal with them.

Peter
June 26th, 2017, 03:35 AM
Well,

I spent good part of last week doing 'research' on FiiO X5 3gen behaviors trying to make foobar2000 robust against such issues.

Problem no. 1: Audio stack customizations
I'm not sure what exact improvements their custom audio stack provides, but it does add strange initialization delays, and a bunch of bugs for me to dodge. At least using OpenSL instead of Java AudioTrack (default) seems to work around most of it. For reference, I managed to fix default AudioTrack output by inserting silence past the end of playlist instead of letting it reach the end of sent audio data.

Problem no. 2: SD card slot 2
The slot is broken. The slot hardware is broken, I think. I experience all the same bugs as reported in this forum thread, so it's not just one faulty unit. It is possible to read music from the slot, but the hardware goes haywire when the device sleeps.
- If your app keeps open file handles to files in /mnt/external_sd2 during a sleep cycle, your app crashes. This is actually easily mitigated on our side, we already have an internal switch to suspend all playback activity on user pause.
- The slot goes haywire upon device wakeup and returns nonsensical data for approximately 3 seconds, either claims empty content or returns random error codes depending on air humidity and phase of the moon.
- Attempts to access the SD slot 2 during the crazy mode period after wakeup often cause the device's audio subsystem to crash completely; it remains unable to play any audio until a reboot. Not even the FiiO player app works. This looks like a clear symptom of hardware being broken, not software, how can SD card access interrupt device's audio playback capabilities?

We effectively trigger the broken behaviors by unpausing playback using the button while the device is asleep.
There has to be a way around this obviously, by making sure we don't actually read our file for the first N seconds after unpausing, but such hack sounds too complex to implement at this time, considering it's just one device with extreme bugs.

Problem no. 3: Unreliable Android debugging
Add insult to injury. Frequently, APK-install-via-ADB fails one way or another, and Android Studio launches old version of my code instead of freshly compiled one. Takes a few tries to get updated code actually running on the device.

Problem no. 4: Wifi vs Bluetooth interference
This should have been the no. 1 because it was the first thing that exploded in my face upon unboxing and the initial setup.
Pairing with my bluetooth headset (Sennheiser PXC 360 BT) made wifi unusably slow, verified with two different wifi networks. All goes back to normal once I turn bluetooth off on the X5.

tl;dr
Use OpenSL and don't use SD card slot 2, only slot 1.
Turn bluetooth off if you require network connectivity.

Peter
June 26th, 2017, 07:34 AM
Update

Amended my code to: detect FiiO + /mnt/external_sd2/ combo and stall for 1 second before starting to hammer the filesystem with read requests after apparent device wakeup, seems to at least mitigate the instability; playback resumes correctly after several seconds of delay.

annoyingmouse
June 27th, 2017, 10:27 AM
depending on air humidity and phase of the moon

Sounds like the best way of summing it up.

I've not been using the bluetooth so I hadn't spotted that particular issue but I have noticed that the Wifi seems a little unreliable.

Peter
June 29th, 2017, 02:32 PM
An update with FiiO fixes is out, beta only for now.

If you do not have beta access yet, please drop me a private message with your Google ID and I'll add you to the list.

oesu
July 12th, 2017, 08:03 AM
Hi,

I have Fiio X7 with latest (3.3.0) firmware and Foobar mobile version 1.0.79. I really like it (way better than stock app), but I have one (small) problem.
I can't get the play/pause and previous/next buttons to work.
I've enabled OpenSL, but it didn't help.

Any help would be appreciated.

oesu
July 12th, 2017, 08:10 AM
play/pause and previous/next buttons

I meant physical buttons, on screen ones work fine.

oesu
July 13th, 2017, 12:26 AM
It seems reboot solved my problems.