summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuCachedSource2.cpp
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2014-09-30 14:17:38 -0700
committerRobert Shih <robertshih@google.com>2014-09-30 17:25:27 -0700
commit4f17dadd3cfd9940893ea042ca8883c6aa6ada07 (patch)
tree87a3e29a1cc626d30ee974c088f1effa79037fca /media/libstagefright/NuCachedSource2.cpp
parenta8a4eeb95988e6bb73f7a742c8dd238c1f96c5c4 (diff)
downloadframeworks_av-4f17dadd3cfd9940893ea042ca8883c6aa6ada07.zip
frameworks_av-4f17dadd3cfd9940893ea042ca8883c6aa6ada07.tar.gz
frameworks_av-4f17dadd3cfd9940893ea042ca8883c6aa6ada07.tar.bz2
NuCachedSource2: fix disconnect process
- clear mAsyncResult - return early from reads if mDisconnecting is set Bug: 17696761 Change-Id: I98bfc3f5f06594915bd58faf71fbcded482664d2
Diffstat (limited to 'media/libstagefright/NuCachedSource2.cpp')
-rw-r--r--media/libstagefright/NuCachedSource2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index f469d4d..bd0a41d 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -456,6 +456,10 @@ void NuCachedSource2::onRead(const sp<AMessage> &msg) {
}
Mutex::Autolock autoLock(mLock);
+ if (mDisconnecting) {
+ mCondition.signal();
+ return;
+ }
CHECK(mAsyncResult == NULL);
@@ -502,6 +506,9 @@ ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) {
ALOGV("readAt offset %lld, size %zu", offset, size);
Mutex::Autolock autoLock(mLock);
+ if (mDisconnecting) {
+ return ERROR_END_OF_STREAM;
+ }
// If the request can be completely satisfied from the cache, do so.
@@ -528,6 +535,7 @@ ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) {
}
if (mDisconnecting) {
+ mAsyncResult.clear();
return ERROR_END_OF_STREAM;
}