diff options
author | Bryan Mawhinney <bryanmawhinney@google.com> | 2012-01-18 13:40:07 +0000 |
---|---|---|
committer | Bryan Mawhinney <bryanmawhinney@google.com> | 2012-01-18 13:43:16 +0000 |
commit | c14cc179729a4504db23d49301ec30fc0cfcbb1c (patch) | |
tree | d2711c9a06ec3089066418ed064b4bf9743ba65e | |
parent | 96c804af0b4eef79f6d3cdb0f20682e243f1b73d (diff) | |
download | frameworks_base-c14cc179729a4504db23d49301ec30fc0cfcbb1c.zip frameworks_base-c14cc179729a4504db23d49301ec30fc0cfcbb1c.tar.gz frameworks_base-c14cc179729a4504db23d49301ec30fc0cfcbb1c.tar.bz2 |
Make sure seek triggers a reconnect if needed.
Previously, if we had disconnected at the high watermark,
the read immediately following a seek would fail, and would
not be retried, resulting in an error.
Change-Id: I45a53563fe17d6b54893815abc7750a7dfb0a124
-rw-r--r-- | media/libstagefright/NuCachedSource2.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp index 693c506..0957426 100644 --- a/media/libstagefright/NuCachedSource2.cpp +++ b/media/libstagefright/NuCachedSource2.cpp @@ -370,6 +370,7 @@ void NuCachedSource2::onFetch() { && (mSource->flags() & DataSource::kIsHTTPBasedSource)) { ALOGV("Disconnecting at high watermark"); static_cast<HTTPBase *>(mSource.get())->disconnect(); + mFinalStatus = -EAGAIN; } } } else { @@ -549,7 +550,7 @@ ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) { size_t delta = offset - mCacheOffset; - if (mFinalStatus != OK) { + if (mFinalStatus != OK && mNumRetriesLeft == 0) { if (delta >= mCache->totalSize()) { return mFinalStatus; } @@ -591,7 +592,7 @@ status_t NuCachedSource2::seekInternal_l(off64_t offset) { size_t totalSize = mCache->totalSize(); CHECK_EQ(mCache->releaseFromStart(totalSize), totalSize); - mFinalStatus = OK; + mNumRetriesLeft = kMaxNumRetries; mFetching = true; return OK; |