am e262a49b: Merge "Fix for b/4279535 Seeking in a video causes it to start form beginning" into honeycomb-mr1

* commit 'e262a49b8dd85317efad07cfe17abc2b71d3caad':
  Fix for b/4279535 Seeking in a video causes it to start form beginning
This commit is contained in:
Jeffrey Tinker
2011-04-28 13:04:56 -07:00
committed by Android Git Automerger

View File

@@ -158,8 +158,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
bool seekNextSync = false; bool seekNextSync = false;
int64_t seekTimeUs; int64_t seekTimeUs;
int retryLimit = 500; // Limit on number of retries before timeout, 10ms per retry
ReadOptions::SeekMode mode; ReadOptions::SeekMode mode;
if (options && options->getSeekTo(&seekTimeUs, &mode)) { if (options && options->getSeekTo(&seekTimeUs, &mode)) {
// When doing a seek, use a longer timeout since we need to set up a new connection
retryLimit = 1500;
//LOGD("%s seek mode=%d, seek time=%lld lateby=%lld", //LOGD("%s seek mode=%d, seek time=%lld lateby=%lld",
// (mESSelector == WV_EsSelector_Video) ? "video" : "audio", // (mESSelector == WV_EsSelector_Video) ? "video" : "audio",
// mode, seekTimeUs, options->getLateBy()); // mode, seekTimeUs, options->getLateBy());
@@ -196,7 +203,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
int64_t keyTime; int64_t keyTime;
bool syncFrame; bool syncFrame;
int retryLimit = 0; int retryCount = 0;
// Pull full access units. Since we aren't sure how big they might be, // Pull full access units. Since we aren't sure how big they might be,
// start with initial buffer size, then allocate a larger buffer if we // start with initial buffer size, then allocate a larger buffer if we
@@ -258,7 +265,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
} }
if (bytesRead == 0) { if (bytesRead == 0) {
if (retryLimit++ >= 500) { if (retryCount++ >= retryLimit) {
// If no data received within the retry limit, return ERROR_IO // If no data received within the retry limit, return ERROR_IO
// This prevents the player from becoming unresponsive // This prevents the player from becoming unresponsive
mediaBuf->release(); mediaBuf->release();