Placeholder-Software / Dissonance

Unity Voice Chat Asset
70 stars 5 forks source link

[Bug] On Android ARMv7 device, AEC fail to start #110

Closed Vuxt4 closed 5 years ago

Vuxt4 commented 6 years ago

Context

More information might related to this: https://github.com/Placeholder-Software/Dissonance/issues/80#issuecomment-410576181

This issue first saw on Version 6.2.0, I have upgraded to 6.2.4 and issue still occurs

Expected Behavior

AEC should start normally when application started

Actual Behavior

following error occurs when application started: 08-07 16:51:43.964 4851 4882 E Unity : Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly.

Steps to Reproduce

  1. See the environment setup at: https://github.com/Placeholder-Software/Dissonance/issues/80#issuecomment-410576181

  2. Start the application and sees: 08-07 16:51:43.964 4851 4882 E Unity : Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly.

Your Environment

Development environment: OS: Win10 UnityEditor: 2017.4.8f1 Dissonance Version: 6.2.4

Target Android Device: CPU: ARMv7

martindevans commented 6 years ago

Someone else has contacted me by email with a similar issue. In their case the AEC seems to work perfectly on PC but simply doesn't load on Mobile - do you have the same issue?

martindevans commented 6 years ago

I've submitted an issue about this to Unity, I'll post a link to track the progress as soon as I have one.

Edit: Here it is

Vuxt4 commented 6 years ago

Yeah, PC works fine, I didn't see such error log pops out, and AEC filter is running as it shows on the editor. I only see the error log appears on my Android/ARMv7 device

martindevans commented 6 years ago

As far as I can see the three possible causes for this are:

Either way, that's something Unity will have to investigate. We'll have to wait and see what they say on that issue - they're usually pretty quick to come back with an initial response.

Why can't it be the first? Normally I would actually assume it's that - it's a fairly common problem for Dissonance users to have (Unity seems to have a lot of issues properly installing native plugins on install). However this can't possibly be that because there are two things in the AudioPluginDissonance file, the preprocessor (which we explicitly invoke from C# code) and the audio filter (which Unity instantiates automagically). If the preprocessor was missing Dissonance would completely crash during the setup stage and nothing would work so we know the file is loaded properly when invoked by Dissonance. Obviously it's just the automagic Unity audio filter loading code which is failing to find the Dissonance Echo Cancellation filter for some reason.

Vuxt4 commented 6 years ago

Yeah, I agree with your point, if library can't be found, we should already have problem with C# preprocessor code, so the best guess might just be the case that something wrong with the audio filter...

Is this only happen on 2017.3.x or 2017.4.x ? Have you ever tried other version of Unity ? (ex: 5.6.x or 2018.1.x, 2018.2.x)

martindevans commented 6 years ago

Tom previously tested the AEC filter on his Android phone with 5.6, as far as I know that worked. Someone else has recently reported this same issue to me by email and it does not work for him on 2018.1.1f1. It's possible this is a regression of some kind in Unity somewhere between 5.6 (where we tested it worked) and 2017.4 (where it does not work for you). Of course it's also possible that it was broken in 5.6 - since this issue doesn't crash the app we could quite easily have missed it.

martindevans commented 6 years ago

Unity have reported that they've managed to reproduce the problem, they're sending it to developers for further investigation.

martindevans commented 5 years ago

There has finally been an update from Unity regarding this issue! They have diagnosed it as an import problem with the audio plugin not being loaded early enough (i.e. before the audio system) so the plugin doesn't exist when the audio system initialises and thus the AEC doesn't exist.

if you take a look at the meta file next to the plugin, you can find "isPreloaded: 0" there. This is the reason why it doesn't work on Android. The easiest way to fix it is to remove the plugin from the project completely, and add the libAudioPluginDissonance.so file again to the project. Please make sure to not add the .meta file. The plugin gets reimported, and the isPreloaded flag is set correctly (you need to set the platform for the plugin to Android manually though).

Could someone who has been affected by this issue try out the fix they suggested (it's very simple):

  1. Open a project which suffers from the Audio effect Dissonance Echo Cancellation could not be found. problem. You simply need the Dissonance Echo Cancellation filter attached to an audio bus for this to happen.
  2. Remove Assets/Plugins/Dissonance/Plugins/Android/libs/armeabi-v7a/libAudioPluginDissonance.so from the project (you may want to note the import settings in the inspector first)
  3. Check that the libAudioPluginDissonance.so.meta file is gone from the file system
  4. Restart the editor
  5. Add libAudioPluginDissonance.so back into the same folder
  6. Set the import settings correctly (Android+ARM)
  7. Check that isPreloaded: 1 is in the meta file
  8. Try it on a phone and verify that the Audio effect Dissonance Echo Cancellation could not be found. message does not appear in the log
abelevtsov commented 5 years ago

Yeah! It's really gone away now! I'm checked it on 2018.3.3f1 il2cpp build and error does not appear in log anymore.

Thank you for your attention to the problem!

martindevans commented 5 years ago

Fantastic, thanks for confirming that it works 👍