Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6583217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:22:49+00:00 2026-05-25T16:22:49+00:00

I have an application where there several threads each pumping into a separate AudioTrack

  • 0

I have an application where there several threads each pumping into a separate AudioTrack set to MODE_STREAM. Switching between apps works fine, and when the application shuts down normally it seems to shut everything down correctly.

However, if the application is terminated externally, such as from the debugger or because I’ve just installed a new version while the old version was running, it seems that some state in the global AudioMixer gets messed up, and I get logcat output like:

09-16 14:50:38.965   298  7150 W AudioTrack: obtainBuffer timed out (is the CPU pegged?) 0x83c2348 user=00000eb3, server=00000000
09-16 14:50:39.025  7066  7132 W AudioTrack: obtainBuffer timed out (is the CPU pegged?) 0x8249d40 user=00002000, server=00000000
09-16 14:50:40.277   298  7156 W AudioTrack: obtainBuffer timed out (is the CPU pegged?) 0x84cb810 user=00000eb3, server=00000000

and no application that uses AudioTrack is able to play audio ever again, until I reboot my device. In this particular log fragment, PID 298 is system_server and 7066 is the new instance of the application.

What I think is happening is that the AudioTrack is disappearing before the writer thread has a chance to clean up. This makes me think that there is something else I should be doing to clean up. I’m already trapping my Activity’s onStop and onDestroy and having those shut down my audio threads, but is there another place that this needs to happen?

Also, is there a better way to clean up AudioTrack? It seems like this part of Android is especially fragile, but I can’t imagine that everyone uses SoundPool and MediaPlayer for everything, as those APIs are very limited and fiddly (and both seem to just wrap AudioTrack in different ways anyway).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:22:50+00:00Added an answer on May 25, 2026 at 4:22 pm

    Unfortunately your app gets no warning before it is killed by the OS and replaced with a new version. You can test this with a very simple Activity where the onPause() onStart() onStop() and onDestroy() methods produce log messages. If you install a new version of the app the messages in the onStop() and onDestroy() methods never get produced.

    With regards to the AudioTrack problem, that is probably a bug your device’s audio drivers. Some people trying to port Android get similar problems due to bad drivers. Additionally, one of the other answers to this question leads me to believe this as well. If this problem is restricted to a subset of phones from a few manufactures and not all phones then this that suggests the manufacturer’s sound drivers are bad.

    Have you considered using the MediaPlayer API instead of AudioTrack. It doesn’t have the same flexibility but it could be a viable workaround. Here is a nice comparison of the three different audio apis.

    One possible work around is to actually split the app into two a separate apks for debugging. One does nothing but plays the audio and is controlled by the second app. This way whenever you install an updated controller the binary playing the audio is unaffected and doesn’t experience the abrupt kill and re-install. Then when you are ready to distribute the app simply combine the two into a single apk and then distribute that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java desktop application with information about several entities. There is a
I have an application deployed into multiple zones and there are some issues with
We are developing a Java application with several worker threads. These threads will have
I have a WPF-application that uses several background threads for precompiling LINQ-queries and precaching
i have a program which is using several threads to execute some task. Each
I have an application where there are multiple processes. They share the reading and
I have a asp.net application.there is a databinding section to a datagrid.But there have
I have an application in which there is a form which I want to
I have a simple Crud application where there is one filed called Category. During
I have made a swings application but there is one problem in that which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.