From 955e78180ac6111c54f50930b0c4c12395e86cf7 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 21 Feb 2012 10:32:45 -0800 Subject: AudioRecord locking Fix race conditions for EVENT_MARKER and EVENT_NEW_POS callbacks. Marker and new position update fields are protected by lock. getSampleRate() doesn't need a lock because it reads from shared memory control block. Enforce that the parameter passed with EVENT_MARKER and EVENT_NEW_POS cannot not be changed by the callback handler, and will not change during the call by another thread. Session ID should never change; log if it does. Change-Id: Ia2c63cf1a71b10bb06c37981bd76437f83fffa91 --- include/media/AudioRecord.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h index 7e66ac9..156c592 100644 --- a/include/media/AudioRecord.h +++ b/include/media/AudioRecord.h @@ -84,8 +84,8 @@ public: * more bytes than indicated by 'size' field and update 'size' if less bytes are * read. * - EVENT_OVERRUN: unused. - * - EVENT_MARKER: pointer to an uin32_t containing the marker position in frames. - * - EVENT_NEW_POS: pointer to an uin32_t containing the new position in frames. + * - EVENT_MARKER: pointer to const uint32_t containing the marker position in frames. + * - EVENT_NEW_POS: pointer to const uint32_t containing the new position in frames. */ typedef void (*callback_t)(int event, void* user, void *info); -- cgit v1.1