From: Robert Shih Date: Tue, 15 Dec 2015 23:22:04 +0000 (-0800) Subject: CallbackDataSource: return bytes read instead of eos on short read X-Git-Tag: android-x86-7.1-r1~859^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=40a3f52cc7d4f657f963d9c2b47007fdfd3fc9dd;p=android-x86%2Fframeworks-av.git CallbackDataSource: return bytes read instead of eos on short read Bug: 25800374 Change-Id: I17af28f85d68dc964179dda8ddf8874c02f202a5 --- diff --git a/media/libstagefright/CallbackDataSource.cpp b/media/libstagefright/CallbackDataSource.cpp index e17fdf8eb0..4c0a578e0c 100644 --- a/media/libstagefright/CallbackDataSource.cpp +++ b/media/libstagefright/CallbackDataSource.cpp @@ -64,7 +64,7 @@ ssize_t CallbackDataSource::readAt(off64_t offset, void* data, size_t size) { mIDataSource->readAt(offset + totalNumRead, numToRead); // A negative return value represents an error. Pass it on. if (numRead < 0) { - return numRead; + return numRead == ERROR_END_OF_STREAM && totalNumRead > 0 ? totalNumRead : numRead; } // A zero return value signals EOS. Return the bytes read so far. if (numRead == 0) {