diff options
| author | Glenn Kasten <gkasten@google.com> | 2012-11-02 13:05:14 -0700 |
|---|---|---|
| committer | Glenn Kasten <gkasten@google.com> | 2012-11-07 16:11:56 -0800 |
| commit | d5ed6e88a9bea1879e41d7defaf1edea7c09f554 (patch) | |
| tree | 99a34f51474700f4873e3f817b6b9f2c47001fc3 /media | |
| parent | 8fa3ad0e4c77f7868348ad2a4cacc34c34e7c39e (diff) | |
| download | frameworks_av-d5ed6e88a9bea1879e41d7defaf1edea7c09f554.zip frameworks_av-d5ed6e88a9bea1879e41d7defaf1edea7c09f554.tar.gz frameworks_av-d5ed6e88a9bea1879e41d7defaf1edea7c09f554.tar.bz2 | |
Fix call to restoreTrack_l() without lock held
Also document lock order
Change-Id: I2c1f273a0a51fa79ee3dd766de8d23083e270051
Diffstat (limited to 'media')
| -rw-r--r-- | media/libmedia/AudioTrack.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 5348646..1f4f3d0 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1122,8 +1122,14 @@ TimedAudioTrack::TimedAudioTrack() { status_t TimedAudioTrack::allocateTimedBuffer(size_t size, sp<IMemory>* buffer) { + AutoMutex lock(mLock); status_t result = UNKNOWN_ERROR; + // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed + // while we are accessing the cblk + sp<IAudioTrack> audioTrack = mAudioTrack; + sp<IMemory> iMem = mCblkMemory; + // If the track is not invalid already, try to allocate a buffer. alloc // fails indicating that the server is dead, flag the track as invalid so // we can attempt to restore in just a bit. |
