Closed drakep closed 5 years ago
1) Only happens on device, works fine in the simulator 2) I don't, but I can recreate it every time just by adding the Echo Cancellation to the Mixer for the playbackprefab audio source 3) It crashes when a playback prefab is loaded, original setup was a loader scene, and a login scene. could load, then login, but when it transitioned to the scene with Dissonance the app crashed. I spent 4 days testing different configurations before one accidently worked. It worked because I re-did the dissonance plugin from the start, and didn't add the echo cancellation to the playbackprefab, only on the spatial prefab. My client asked about the echos on device, so I readded the echo cancellation, and the app started crashing again. The only reason I was able to pinpoint the issue was that chance scene change.
Have you checked out the deployment requirements: https://dissonance.readthedocs.io/en/latest/Basics/End-User-Requirements/ and ensured that the correct dependencies are installed? If you have, or doing so doesn't help, carry on with the rest of this post :)
Only happens on device, works fine in the simulator
Unfortunately I don't have a hololens so this is going to make things very difficult to debug :(
Could you raise the logging settings to Debug
for all categories (Windows > Dissonance > Diagnostic Settings`), deploy the application to the hololens and give me the log?
It worked because I re-did the dissonance plugin from the start, and didn't add the echo cancellation to the playbackprefab
The playback prefab itself doesn't have any kind of echo cancellation attached. Do you mean you didn't route your new playback prefab through an audio mixer group
with the Dissonance Echo Cancellation
filter?
Log from discord: https://pastebin.com/Pq1TZRj6
That was when the scene loaded, not on app launch This was on device, IL2CPP
Hi drakep, did you ever manage to make any progress on this? I know I wasn't much help because it seems to be impossible to reproduce anywhere but on the device which made it almost impossible for me to debug, but if there's anything I can do to help feel free to ask.
It's probably worth contacting Unity if the issue still persists. Anything which is different between the simulator and the real device is probably something very low level which they will be better equipped to help with.
Hey Martin.
It does appear that this issue isn't fixed, or a separate issue has occurred in Version 3.0.3.
Bizarely, this issue doesn't occur in an empty project.
`TypeLoadException: Unresolved P/Invoke method 'opus_encoder_create!opus' in assembly 'Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because it is not available in UWP applications. Please either use an another API , or use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP application APIs.
at Dissonance.Audio.Codecs.Opus.OpusNative.OpusEncoder..ctor(Int32 srcSamplingRate, Int32 srcChannelCount)
at Dissonance.CodecSettingsLoader.CreateEncoder(AudioQuality quality, FrameSize frameSize, Boolean fec)
at Dissonance.CodecSettingsLoader.Generate()
at Dissonance.DissonanceComms.Start()
at Dissonance.DissonanceComms.$Invoke65(Int64 instance, Int64 args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64 args, IntPtr method)`
Cheers, James Mills
3.0.3 is a really old version (almost 10 months old), could you try upgrading to the latest version?
Hey Martin,
Just updated and got the same issue
I am also however using Unity 2017.2.0p2-MRTP5 with Dissonance 6.2.4
Currently trying to reproduce in an empty project
Could you send me a log with the debug settings elevated to Debug (Windows > Dissonance > Diagnostic Settings
) - logging settings are baked into the built application so you should be able to build it, deploy it, and capture a log.
Preferably from a clean reproduction of course, but if you can't manage that send me one from wherever else you're encountering the problem :)
I was unable to get the crash to occur in an empty project... I am currently working on getting the logs for you with debug status set
Apart from the obvious it being an empty project, all the settings were set to the exact same which is what has thrown me off here
So @martindevans I turned on debug logs and got the same error:
Does this happen in the hololens simulator, or only on the device itself? I never managed to help out drakep because it was something that only happened on the device itself (and unfortunately I don't have a hololens). It looks like this may be simpler to solve (perhaps as simple as adding [DllImport(ExactSpelling=true)]
to all the Dll Imports in Dissonance.
I've done some research on exactly what this ExactSpelling
parameter means and it looks like it should be safe to set that on all the DllImport
attributes in Dissonance. Can you try changing just the DllImport on opus_encoder_create
in Assets/Plugins/Dissonance/Core/Audio/Codecs/Opus/Opus.cs
to this:
[DllImport("opus", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
This should fix the problem for that method, and then crash at some later method (whatever the next call is without this change applied). If that fixes the issue I'll apply the change to every single DllImport
in Dissonance and that should fix the issue for the next release.
It only happens in a built UWP project, with MRToolkit put in it. I will test your fix now
It doesn't have to be put on a MR Headset or Hololens for the issue to occur though... The PC it is occuring on is running just a standard UWP project that is a server for a couple of MR Headsets. After testing your fix, I will test in an empty project with MR Toolkit and seeing if the game crashes with Dissonance. Potentially MR Toolkit could be blocking the Opus DLL?
You can actually reproduce the issue without a MR Headset or Hololens headset.... simply just build a project in UWP with MRToolkit and Dissonance in it, in 2D mode (don't check XR Settings) and go through the whole build process... and you can reproduce it
So applying that fix has actually caused it to not run at all now... I can build fine, but it crashes the second it launches because it is missing the DLL.
You can actually reproduce the issue
That's good to know, thankyou. I'll have a look into it tomorrow :)
it crashes the second it launches
What's the error it's producing now? If it's failing due to a missing DLL I suspect that the fix actually worked and it's failing for some other reason (perhaps the more exact spelling of the name is incorrect or I chose the wrong CharSet encoding).
The exact error is Missing DLL... but it doesn't tell you which one unfortently
I'm just triple confirming that it happens when MRTK is in the project.
Do you have a reproduction project which you could send me (martin@placeholder-software.co.uk)? I know you mentioned above you weren't able to reproduce this in a clean project, so I understand if you don't want to send your entire project to me!
I'll have to leave this until tomorrow to try to reproduce this and investigate some more (it's 3am 😴). If you have the time before then it would be helpful to try out the other possible values of the CharSet
field - there are only three possible values as CharSet.None
is invalid.
Hey Martin, if this empty project test I am doing now has the issue, I will send you that one. Since there is nothing confidential in it.
Unfortunately... the crash did not happen. And I cannot send you the actual production project for confidentiality reasons.
It took me a while to get all the MRTK stuff installed and setup but I've finally managed to get a test project in Unity 2018.2.6f1. I imported Dissonance from the store (6.2.4
) and added the MRTK from here (2017.1.4.0
). Unfortunately running it in the simulator doesn't reproduce the problem for me.
Can I get you to open up an issue on the MRTK project asking about custom DLLs+DllImport
and this ExactSpelling warning. If you link the issue here I can follow up with any Dissonance specific details they want.
I wasn't using that latest of a Unity version... I'm all the way back at 2017.2.0p2-MRTP5
Would it be alright if we move this conversation to emails? And then when we work out the problem and fix it... Post it here?
I believe it probably is on Dissonance's side that the issue is occurring, since the moment I remove it... no issues what-so-ever
I'm sure the issue is caused by the DLLs which Dissonance is using, but I have no expertise with MRTK so I don't really know how to proceed with fixing this. The MRTK repo has quite a few issues and PRs which mention ExactSpelling
so it seems to be an issue they're aware of - I suspect if we ask them they'll be able to tell us the solution right away.
Would it be alright if we move this conversation to emails?
Sure, you can contact me at martin@placeholder-software.co.uk :)
I have opened an issue on MRTK and one of the guys working on the project is having a look through issue this to see how he can help us. :)
Hey @martindevans just wondering if there's been any progress on working out what is going on here?
I've been waiting for some feedback from the MRTK project. Since this doesn't happen in an empty project it's obviously not a simple problem, it must be some odd interaction with Dissonance, MRTK and something about the specific way your project is set up.
The only other thing I can think of testing is to try to call one of the methods into AudioPluginDissonance.dll
instead of opus.dll
- they're built in slightly different ways so if that works it may suggest a fix for opus (I think that's fairly unlikely though). If you want to try that you can find an appropriate DllImport on line 75 of Assets/Plugins/Dissonance/Core/Audio/Capture/WebRtcPreprocessingPipeline.cs
- simply copy that DllImport statement out to somewhere and call it before Dissonance is initialised.
Hey Martin,
Sorry for such a delayed response, have been busy. I would like to try this test, but I am unsure what you mean.
Hi James, no worries :)
There are 2 DLLs in Dissonance: Opus.dll
and AudioPluginDissonance.dll
. They're built with slightly different build systems so it's possible that there is some problem present in Opus.dll
which is causing your problem which is not present in AudioPluginDissonance.dll
. My suggestion is simply to try calling a method contained within AudioPluginDissonance.dll
to see if it produces the same error. You can do that with a script like this:
class TestScript
: MonoBehaviour
{
void Start()
{
Dissonance_CreatePreprocessor(/* pass in any parameters, it doesn't matter what they are for this test */);
}
[DllImport("AudioPluginDissonance", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr Dissonance_CreatePreprocessor(
NoiseSuppressionLevels nsLevel,
AecSuppressionLevels aecLevel, bool aecDelayAgnostic, bool aecExtended, bool aecRefined,
AecmRoutingMode aecmRoutingMode, bool aecmComfortNoise
);
}
That line should crash with a similar error to the opus calls, if it doesn't then perhaps I can try to work out why not and apply that fix to opus.dll
.
Alright, I'll try that and keep you updated Martin, got some build issues right now, so I probably won't be able to test it until after you go to bed.
Did you want me to put that in an offline scene or online one?
I assume offline will be sufficient, if the error is the same it should happen as soon as the method is called regardless of any other context.
Hey Martin,
Please find attached here the build logs for the project (well, most of them, I had to redact some parts due to confidentiality) so you can see all the errors.
I have tested that call, and it didn't seem to crash https://github.com/Placeholder-Software/Dissonance/issues/103#issuecomment-424541549
The build logs shows warnings for both methods but they produce different results:
Unresolved P/Invoke method 'opus_encoder_create!opus'
which causes a crash (when called within Dissonance).Unresolved P/Invoke method 'Dissonance_CreatePreprocessor!AudioPluginDissonance'
which is fine (according to test script).I'll post over on the MRTK issue about these results. Hopefully they may have some suggestions for build settings which are likely to be related, and then I can compare those settings between the two DLLs and see which ones are different.
The latest version of Dissonance (6.3.0) includes a new set of UWP plugin binaries to fix some other problems (#135). I never got to the bottom of this particular issue but it may be worth seeing if those updates help.
Context
When using the echo cancellation mixer effect with UWP app on HoloLens, app crashes upon start
Expected Behavior
App does not crash, echos get cancelled
Actual Behavior
App Crashes, no echo cancellation
Workaround
None
Fix
None
Steps to Reproduce
Provide a detailed set of steps to reproduce the problem
Your Environment
Include as many relevant details about the environment you experienced the bug in
Dissonance version used: Version on store on June 19th
Unity version: 2017.2.2f2 and 2018.1.5f1
Editor Operating System and version: Windows 10 Pro, 17677
Build Settings: HoloLens, UWP x86
Link to your project: Is not, but you get the same behavior on HoloLens with any introduction of the echo cancellation