diff options
author | Andreas Huber <andih@google.com> | 2011-03-30 14:45:22 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-03-30 15:00:34 -0700 |
commit | 45ad57aab33428575d7cde917e9477aac26beb71 (patch) | |
tree | d36610b2e25b2ccc944035f589775d656a58eacc /media | |
parent | e4f33617c3654bdcb246ee8f74e67d1828cd42c9 (diff) | |
download | frameworks_base-45ad57aab33428575d7cde917e9477aac26beb71.zip frameworks_base-45ad57aab33428575d7cde917e9477aac26beb71.tar.gz frameworks_base-45ad57aab33428575d7cde917e9477aac26beb71.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')
-rw-r--r-- | media/libstagefright/NuHTTPDataSource.cpp | 9 |
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; |