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

Make CallService sounds thread-safe #1201

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

liviu-timar
Copy link
Member

🎯 Goal

Make sound-related operations thread safe in CallService to avoid race conditions related to object instantiation, playing/stopping sounds and cleaning resources.

🛠 Implementation details

  • Synchronized mediaPlayer and ringtone object creation.
  • Synchronized property and method access for these objects
  • Marking object references with @Volatile is not needed, as both the instantiation and subsequent operations are synchronized, which takes care of visibility across threads.

@liviu-timar liviu-timar marked this pull request as ready for review October 9, 2024 15:01
@liviu-timar liviu-timar requested a review from a team as a code owner October 9, 2024 15:01
@aleksandar-apostolov aleksandar-apostolov merged commit dd20b33 into develop Oct 10, 2024
7 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the make-sounds-thread-safe branch October 10, 2024 07:57
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