summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/OggExtractor.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-05-10 16:14:51 -0700
committerAndreas Huber <andih@google.com>2011-05-10 16:16:27 -0700
commitdf659ac173b247b4ad440fb2979ff51ff45e0aa4 (patch)
tree04fa1a3099195eebc11147861e656fbecc30ed76 /media/libstagefright/OggExtractor.cpp
parentc0dfc5b02d4179769bbdd25c10d430576ec09568 (diff)
downloadframeworks_av-df659ac173b247b4ad440fb2979ff51ff45e0aa4.zip
frameworks_av-df659ac173b247b4ad440fb2979ff51ff45e0aa4.tar.gz
frameworks_av-df659ac173b247b4ad440fb2979ff51ff45e0aa4.tar.bz2
Make sure the ogg extractor returns appropriate error codes.
Change-Id: I36cbf58aa6fa9195e1cc052f91e1183f57069d03
Diffstat (limited to 'media/libstagefright/OggExtractor.cpp')
-rw-r--r--media/libstagefright/OggExtractor.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 6538a05..1560b8e 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -378,12 +378,19 @@ status_t MyVorbisExtractor::seekToOffset(off64_t offset) {
ssize_t MyVorbisExtractor::readPage(off64_t offset, Page *page) {
uint8_t header[27];
- if (mSource->readAt(offset, header, sizeof(header))
+ ssize_t n;
+ if ((n = mSource->readAt(offset, header, sizeof(header)))
< (ssize_t)sizeof(header)) {
- LOGV("failed to read %d bytes at offset 0x%016llx",
- sizeof(header), offset);
+ LOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes",
+ sizeof(header), offset, n);
- return ERROR_IO;
+ if (n < 0) {
+ return n;
+ } else if (n == 0) {
+ return ERROR_END_OF_STREAM;
+ } else {
+ return ERROR_IO;
+ }
}
if (memcmp(header, "OggS", 4)) {
@@ -498,8 +505,8 @@ status_t MyVorbisExtractor::readNextPacket(MediaBuffer **out) {
packetSize);
if (n < (ssize_t)packetSize) {
- LOGV("failed to read %d bytes at 0x%016llx",
- packetSize, dataOffset);
+ LOGV("failed to read %d bytes at 0x%016llx, got %ld bytes",
+ packetSize, dataOffset, n);
return ERROR_IO;
}