diff options
author | Andreas Huber <andih@google.com> | 2011-09-02 09:34:51 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-09-02 09:34:51 -0700 |
commit | 3a13fad63af40a8364fce796b1a54a8f0a2fbf32 (patch) | |
tree | a99d1e91d87550a46a523acfc0734a72f56db917 /media/libstagefright/FileSource.cpp | |
parent | d681bbb1767bed09415e050ba78975df214bcd68 (diff) | |
download | frameworks_av-3a13fad63af40a8364fce796b1a54a8f0a2fbf32.zip frameworks_av-3a13fad63af40a8364fce796b1a54a8f0a2fbf32.tar.gz frameworks_av-3a13fad63af40a8364fce796b1a54a8f0a2fbf32.tar.bz2 |
Properly serialize access to FileSource::getSize by acquiring the mutex
Both ::getSize and ::read call into lseek64, if this happens simultaneously
from multiple threads the results are undefined if not properly serialized.
Change-Id: I737cafebd836f3d8eb702beac557b4731f69c6f6
related-to-bug: 5196490
Diffstat (limited to 'media/libstagefright/FileSource.cpp')
-rw-r--r-- | media/libstagefright/FileSource.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index f2f3500..0794f57 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -110,6 +110,8 @@ ssize_t FileSource::readAt(off64_t offset, void *data, size_t size) { } status_t FileSource::getSize(off64_t *size) { + Mutex::Autolock autoLock(mLock); + if (mFd < 0) { return NO_INIT; } |