summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuHTTPDataSource.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-30 14:45:22 -0700
committerAndreas Huber <andih@google.com>2011-03-30 15:00:34 -0700
commit9dc0193472834c49e6bdc864fbeb145828f1d8aa (patch)
tree451bbd7080e3f947106f13a9b1bde70a8660ce2e /media/libstagefright/NuHTTPDataSource.cpp
parent98442ddd86ea33453c2db10cfbfc310ae49dce8f (diff)
downloadframeworks_av-9dc0193472834c49e6bdc864fbeb145828f1d8aa.zip
frameworks_av-9dc0193472834c49e6bdc864fbeb145828f1d8aa.tar.gz
frameworks_av-9dc0193472834c49e6bdc864fbeb145828f1d8aa.tar.bz2
When http streaming and Content-Length is unknown, make sure to return all
data that we successfully received before signalling the error. Change-Id: I7e60602d41b4df85aa85e413c590687305e9bbce related-to-bug: 4190765
Diffstat (limited to 'media/libstagefright/NuHTTPDataSource.cpp')
-rw-r--r--media/libstagefright/NuHTTPDataSource.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp
index b24343f..bee0d5e 100644
--- a/media/libstagefright/NuHTTPDataSource.cpp
+++ b/media/libstagefright/NuHTTPDataSource.cpp
@@ -410,7 +410,14 @@ ssize_t NuHTTPDataSource::readAt(off64_t offset, void *data, size_t size) {
internalRead((uint8_t *)data + numBytesRead, size - numBytesRead);
if (n < 0) {
- return n;
+ if (numBytesRead == 0 || mContentLengthValid) {
+ return n;
+ }
+
+ // If there was an error we want to at least return the data
+ // we've already successfully read. The next call to read will
+ // then return the error.
+ n = 0;
}
int64_t delayUs = ALooper::GetNowUs() - startTimeUs;