gartnera / headunit

Headunit for Android Auto
GNU Affero General Public License v3.0
348 stars 90 forks source link

Media sound stuttering when AA maps update #160

Closed ixnewton closed 4 years ago

ixnewton commented 5 years ago

When AA navigation loads or starts navigation requiring significant map updates audio is interrupted causing stuttering of the sound. This may well be a limitation of the USB2 connection data rate however there may be possible solutions. Maybe increasing any data caching for audio streams may be sufficient or applying some sort of QoS prioritizing audio.

It does not seem to make any difference disabling BT audio so I assume audio is routed over USB with the map screen cast data. Another possibility may be to maintain audio streaming over the BT connection.

Having checked the code there is a big learning curve to find the parts involved so your comments or suggested fix would be welcome.

ixnewton commented 5 years ago

Looks like there is some chance to configure Gstreamer in outputs.cpp where the parameters are set in vid_pipeline_launch. Looking at the Gstreamer reference site adjustment of latency values may help or working with stream qos to reduce video priority so favouring audio. To test these can the code version for headunit v1.11 be made available on Github?

Trevelopment commented 5 years ago

Why don't you just try those changes with the current code? To find the code for v1.11 you just have to go back a bunch of commits to like here: https://github.com/gartnera/headunit/commit/61ee618f2a7a4ce8c8d07ef7a2690a3a81724ca4 but you should just use the current code since I am going to use that for the next version of AA in AIO. By the way I already tried this but hopefully you know how to do it better than I do.

ixnewton commented 4 years ago

I've been running the latest build v1.12 on my CX5 and the stuttering when displaying map updates is much reduced and compares well with a standard Android Auto on a new series Audi A1. There is similar but minor stuttering during the same map update process which occurs in the same way when a new destination is selected. This build also is more consistent at startup or re-connection avoiding the frozen/black screen. The Audi has the benefit of USB 3 connection.

csirek commented 4 years ago

I tried it too on FW56.0.512. The stuttering is much less then the v1.11, but present. - Is there any suggested FW version for AIO AA?

But when i connect the phone to the car via usb BEFORE the ignition, and started the car, the AA is frozen (not detect my touch). Unplug, the phone, waited the Bluetooth connection with synchronization, and after connect back the phone the AA started and worked normally.

On Wed, 6 Nov 2019 at 12:17, Ian Newton notifications@github.com wrote:

I've been running the latest build v1.12 and the stuttering when displaying map updates is much reduced and compares well with a standard Android Auto on a new series Audi A1. There is similar but minor stuttering during the same map update process which occurs in the same way when a new destination is selected. This build also is more consistent at startup or re-connection avoiding the frozen/black screen.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gartnera/headunit/issues/160?email_source=notifications&email_token=AHTQSZ4AVYFTS2EEUO4CKETQSKRTNA5CNFSM4IVUPB3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDGGE6Q#issuecomment-550265466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHTQSZZ6E4LW7JTX42LXU3DQSKRTNANCNFSM4IVUPB3A .

ixnewton commented 4 years ago

Some things I found help avoid what I think are USB hang-up problems. (FW56.00.513)

  1. Remove any USB drive used for music. Old slow low consumption drives can work. I have an old microSD card reader with a 16Gb card which seems OK.
  2. Uninstall swapfile as it is not really helpful with this build which is a small executable.
  3. Full reboot clears down memory and should help AA to operate with memory headroom
  4. A workaround for me for hang-ups is to use a small USB printer switch from e-bay for disconnect/connect by button press.

This may suggest that there is a potential fix in the headunit to detect and re-set the USB when data flow does not happen?

ixnewton commented 4 years ago

There are 2 sides to this development and since Google updated AA phone app end of October things are much smoother. The AA team are probably fixing these issues for many car installations.

I only get problems when using USB music, so I have removed the drive and SD navigation card so only the phone uses the USB hub. Neither are necessary as stored music on the phone plays well (Pulsar+ player) by bluetooth or in AA. Again Mazda navigation is never used as it is primitive compared to AA.

The USB switch is no longer useful so has also gone.

This would suggest re-mapping the car navigation button to launch AA would be a nice tweak option?

ixnewton commented 4 years ago

Thanks for closing this! With the latest compile of the gartnera/headunit code we have a version which shows only minor interruptions to the sound streams (https://github.com/gartnera/headunit/files/4235978/AndroidAuto_v1.05-52-g54b38d6.zip). The interruptions or stuttering seem only to be when navigation switches audio to make guidance announcements/info. The same effect is present on another system currently in Audi cars so not a problem which can be solved here. Google may improve this in AA itself handling audio merge/switching on the phone side? Using a good player (Poweramp, Rocket, Pulsar etc) to play audio from the phone in AA avoids USB issues where the USB player hogs memory or USB preventing headunit launch.