PatchTrack: Ensure enough data to write once
Underrun can occur for AudioPlaybackCapture in the secondary PlaybackThread. When the primary PlaybackThread is blocked by any reason during playback, e.g. A2DP suspend, interceptBuffer is also blocked and data will not be provided to the PatchRecord buffer. But the secondary PlaybackThread is still running, exhausting the data in the PatchTrack. As mFillingUpStatus of the PatchTrack is still FS_ACTIVE, the secondary PlaybackThread continues even though framesReady() is not filled to threshold (mFrameCountToBeReady). So, underrun happens repeatedly. To avoid this issue, check if the PatchTrack has enough data in releaseBuffer(); if not, change mFillingUpStatus to FS_FILLING, and wait for the buffer to fill. Bug: 144009535 Change-Id: Ifcbaea05228064284dfaa9b629c8860b1fbe977d
Loading
Please register or sign in to comment