diff options
Diffstat (limited to 'media/libstagefright/httplive/LiveSession.cpp')
-rw-r--r-- | media/libstagefright/httplive/LiveSession.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 90ee3b0..61c54c1 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -626,7 +626,7 @@ sp<PlaylistFetcher> LiveSession::addFetcher(const char *uri) { * - block_size == 0 means entire range * */ -status_t LiveSession::fetchFile( +ssize_t LiveSession::fetchFile( const char *url, sp<ABuffer> *out, int64_t range_offset, int64_t range_length, uint32_t block_size, /* download block size */ @@ -677,6 +677,7 @@ status_t LiveSession::fetchFile( buffer->setRange(0, 0); } + ssize_t bytesRead = 0; // adjust range_length if only reading partial block if (block_size > 0 && (range_length == -1 || buffer->size() + block_size < range_length)) { range_length = buffer->size() + block_size; @@ -724,6 +725,7 @@ status_t LiveSession::fetchFile( } buffer->setRange(0, buffer->size() + (size_t)n); + bytesRead += n; } *out = buffer; @@ -734,7 +736,7 @@ status_t LiveSession::fetchFile( } } - return OK; + return bytesRead; } sp<M3UParser> LiveSession::fetchPlaylist( @@ -745,9 +747,9 @@ sp<M3UParser> LiveSession::fetchPlaylist( sp<ABuffer> buffer; String8 actualUrl; - status_t err = fetchFile(url, &buffer, 0, -1, 0, NULL, &actualUrl); + ssize_t err = fetchFile(url, &buffer, 0, -1, 0, NULL, &actualUrl); - if (err != OK) { + if (err <= 0) { return NULL; } |