Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAVAND-2991 - Optimized TextToSpeech usage #7833

Merged
merged 3 commits into from
Jun 21, 2024

Conversation

tomaszrybakiewicz
Copy link
Contributor

Issue

NAVAND-2991

Description

Backporting v3 optimization https://github.com/mapbox/navigation/pull/5638

NavSDK 2.0 traces captured from "examples > Voice Example" activity running on Android Emulator.

Call Baseline Optimized
TextToSpeechProvider.getTextToSpeech(...) MAIN
21ms
DEFAULT
30ms
VoiceInstructionsTextPlayer.initializeWithLanguage(...) MAIN
207ms
DEFAULT
508ms
textToSpeech.speak(...) MAIN
25ms
1ms
DEFAULT
15ms
1ms

I've moved both initializeWithLanguage(...) and textToSpeech.speak(...) calls to the background thread to optimize this. Additionally, I've updated the "examples > Voice Example" activity to initialize MapboxVoiceInstructionsPlayer off the main thread. The optimized execution time slightly increased due to lesser background thread prioritization.

navsdk-cpu-perfetto.baseline.trace.zip
navsdk-cpu-perfetto.optimized.trace.zip

Moved language setting and speak calls to a background thread.
@tomaszrybakiewicz tomaszrybakiewicz requested a review from a team as a code owner June 20, 2024 21:11
Copy link

github-actions bot commented Jun 20, 2024

Changelog

Features

Bug fixes and improvements

  • Fixed UI jank caused by on-device TextToSpeech player. [#7833](https://github.com/mapbox/mapbox-navigation-android/pull/7833)

Known issues ⚠️

Other changes

Android Auto Changelog

Features

Bug fixes and improvements

  • The app is now considered as the one in active navigation only when an active route is set to MapboxNavigation. Previously it was always considered active. [#7366](https://github.com/mapbox/mapbox-navigation-android/pull/7366)
  • When Android Auto host tells the app to stop active navigation because another app starts navigating, now SDK will enter FreeDrive mode instead of stopping trip session completely. [#7366](https://github.com/mapbox/mapbox-navigation-android/pull/7366)

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 4 lines in your changes missing coverage. Please review.

Project coverage is 74.17%. Comparing base (ef828e6) to head (1901e79).

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #7833   +/-   ##
=========================================
  Coverage     74.16%   74.17%           
+ Complexity     6265     6262    -3     
=========================================
  Files           856      856           
  Lines         33779    33789   +10     
  Branches       4023     4023           
=========================================
+ Hits          25053    25062    +9     
- Misses         7168     7170    +2     
+ Partials       1558     1557    -1     
Files Coverage Δ
...gation/ui/voice/api/VoiceInstructionsTextPlayer.kt 82.02% <88.88%> (+1.00%) ⬆️

@tomaszrybakiewicz tomaszrybakiewicz merged commit 9b40acb into main Jun 21, 2024
39 of 43 checks passed
@tomaszrybakiewicz tomaszrybakiewicz deleted the tr/NAVAND-2991/tts-player-optimizations branch June 21, 2024 12:46
DzmitryFomchyn pushed a commit that referenced this pull request Jul 22, 2024
* NAVAND-2991 - Optimized TextToSpeech usage

Moved language setting and speak calls to a background thread.

* Rename changelog files

* NAVAND-2991 - Optimized TextToSpeech usage

Unit-test fix

---------

Co-authored-by: runner <runner@fv-az1428-633>
DzmitryFomchyn added a commit that referenced this pull request Jul 22, 2024
* NAVAND-2991 - Optimized TextToSpeech usage

Moved language setting and speak calls to a background thread.

* Rename changelog files

* NAVAND-2991 - Optimized TextToSpeech usage

Unit-test fix

---------

Co-authored-by: Tomasz Rybakiewicz <[email protected]>
Co-authored-by: runner <runner@fv-az1428-633>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants