rhysmorgan134 / node-CarPlay

MIT License
147 stars 25 forks source link

Known issues #37

Open steelbrain opened 1 year ago

steelbrain commented 1 year ago

We should document known issues somewhere, not sure what's the best place to do so

I'd start with this one:

Hence I was getting inconsistent reset experience in node vs browser

rhysmorgan134 commented 11 months ago

@gozmanyoni I've noticed that using the WebUSB implementation, and also the ringbuf-pcm-player, any user interaction seems to block the thread, which then produces some audio distortion. On a pi, anything as small as changing a number in react-carplays settings page will cause some micro stutter. Strangely though using carplay and navigating around that, causes no issues. I suspect that maybe the audio players and also the worker message handler likely needs to go into it's own worker? Would you agree with this before I jump in? Just incase I am not missing a more ideal solution. I'm unsure why this was never a problem with the old set up and PCM-Player, my guess is it's likely due to node handling the dongle messages, which then perhaps makes me think I may be on the wrong path with my thinking!

gozmanyoni commented 11 months ago

@rhysmorgan134 I thought about this but since I didnt test much and did not observe the main thread struggle I didnt pursue this.

But i think its defiantly a problem and we can solve it :) the main thread shouldnt care about these pieces of data(Audio/video messages) and ideally the workers will share them among each other directly. this way interactivity should never interfere with playback or dongle handling.

I managed to get Video streaming directly from Carplay to renderer - https://github.com/rhysmorgan134/node-CarPlay/pull/74

And I have an idea on that PR on how to do the audio as well, I dont think we need seperate workers (Audio is already on a separate thread), but rather - every time we create an audio player, we send the shared array buffer to the carplay worker, and it will be the one writing audio data to the player. this might require a change in the pcm-audio-player package to expose a lean audio writer that can be used by the worker.