OSDN Git Service
(root)
/
android-x86
/
frameworks-av.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d681bbb
)
Properly serialize access to FileSource::getSize by acquiring the mutex
author
Andreas Huber
<andih@google.com>
Fri, 2 Sep 2011 16:34:51 +0000
(09:34 -0700)
committer
Andreas Huber
<andih@google.com>
Fri, 2 Sep 2011 16:34:51 +0000
(09:34 -0700)
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
media/libstagefright/FileSource.cpp
patch
|
blob
|
history
diff --git
a/media/libstagefright/FileSource.cpp
b/media/libstagefright/FileSource.cpp
index
f2f3500
..
0794f57
100644
(file)
--- 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;
}