summaryrefslogtreecommitdiffstats
path: root/include/private
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-03-28 18:37:07 -0700
committerEric Laurent <elaurent@google.com>2011-04-05 12:05:41 -0700
commitae29b7632ecf2068698c0d121cff284dcc82f4ec (patch)
treec8193b55997aa1f605a8c80acc76b0b21d101e4e /include/private
parent42bc0e946f8b986fb3aaada9980b496172e2b511 (diff)
downloadframeworks_base-ae29b7632ecf2068698c0d121cff284dcc82f4ec.zip
frameworks_base-ae29b7632ecf2068698c0d121cff284dcc82f4ec.tar.gz
frameworks_base-ae29b7632ecf2068698c0d121cff284dcc82f4ec.tar.bz2
New fix for issue 4111672: control block flags
The first fix (commit 913af0b4) is problematic because it makes threads in mediaserver process block on the cblk mutex. This is not permitted as it can cause audio to skip or worse have a malicious application prevent all audio playback by keeping the mutex locked. The fix consists in using atomic operations when modifying the control block flags. Also fixed audio_track_cblk_t::framesReady() so that it doesn't block when called from AudioFlinger (only applies when a loop is active). Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
Diffstat (limited to 'include/private')
-rw-r--r--include/private/media/AudioTrackShared.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 4610135..1827c3e 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -83,13 +83,12 @@ struct audio_track_cblk_t
uint8_t frameSize;
uint8_t channelCount;
- uint16_t flags;
-
uint16_t bufferTimeoutMs; // Maximum cumulated timeout before restarting audioflinger
- uint16_t waitTimeMs; // Cumulated wait time
+ uint16_t waitTimeMs; // Cumulated wait time
uint16_t sendLevel;
- uint16_t reserved;
+ volatile int32_t flags;
+
// Cache line boundary (32 bytes)
audio_track_cblk_t();
uint32_t stepUser(uint32_t frameCount);
@@ -98,6 +97,7 @@ struct audio_track_cblk_t
uint32_t framesAvailable();
uint32_t framesAvailable_l();
uint32_t framesReady();
+ bool tryLock();
};