diff options
author | Patrik Lindgren <patrik2.lindgren@sonymobile.com> | 2014-12-22 09:06:21 +0100 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-01 15:27:23 -0800 |
commit | f474d172dd6796e85f5a8b0ae4e28b946e0415cd (patch) | |
tree | 1ab4c61c6948fa317206b39ea5a3b41e8b21aeb9 | |
parent | bc585fb49598eaa9b5d6fd888519eb2873310599 (diff) | |
download | frameworks_av-f474d172dd6796e85f5a8b0ae4e28b946e0415cd.zip frameworks_av-f474d172dd6796e85f5a8b0ae4e28b946e0415cd.tar.gz frameworks_av-f474d172dd6796e85f5a8b0ae4e28b946e0415cd.tar.bz2 |
Handle error result from DrmManagerClient correctly
readAtDRM() must handle the case when DrmManagerClient::pread()
returns an error (-1) correctly. This is a degrade in Android L.
Change-Id: Id7ff124d178e26931dddac5ac73697cfe6da501c
-rw-r--r-- | include/media/stagefright/FileSource.h | 2 | ||||
-rw-r--r-- | media/libstagefright/FileSource.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/media/stagefright/FileSource.h b/include/media/stagefright/FileSource.h index 7051b20..f4f874f 100644 --- a/include/media/stagefright/FileSource.h +++ b/include/media/stagefright/FileSource.h @@ -61,7 +61,7 @@ private: sp<DecryptHandle> mDecryptHandle; DrmManagerClient *mDrmManagerClient; int64_t mDrmBufOffset; - size_t mDrmBufSize; + ssize_t mDrmBufSize; unsigned char *mDrmBuf; ssize_t readAtDRM(off64_t offset, void *data, size_t size); diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index f7b1a02..eaa41ff 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -168,7 +168,7 @@ ssize_t FileSource::readAtDRM(off64_t offset, void *data, size_t size) { } if (mDrmBuf != NULL && mDrmBufSize > 0 && (offset + mOffset) >= mDrmBufOffset - && (offset + mOffset + size) <= (mDrmBufOffset + mDrmBufSize)) { + && (offset + mOffset + size) <= static_cast<size_t>(mDrmBufOffset + mDrmBufSize)) { /* Use buffered data */ memcpy(data, (void*)(mDrmBuf+(offset+mOffset-mDrmBufOffset)), size); return size; @@ -179,7 +179,7 @@ ssize_t FileSource::readAtDRM(off64_t offset, void *data, size_t size) { DRM_CACHE_SIZE, offset + mOffset); if (mDrmBufSize > 0) { int64_t dataRead = 0; - dataRead = size > mDrmBufSize ? mDrmBufSize : size; + dataRead = size > static_cast<size_t>(mDrmBufSize) ? mDrmBufSize : size; memcpy(data, (void*)mDrmBuf, dataRead); return dataRead; } else { |