Fix for b/4279535 Seeking in a video causes it to start form beginning

Use a longer timeout than normal when seeking

Change-Id: I8c1306818e5fffefc15c33bd4f412f9346e8dc7e
This commit is contained in:
Jeffrey Tinker
2011-04-27 19:31:18 -07:00
parent 88aa52ffdf
commit e7768d52b0

View File

@@ -158,8 +158,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
bool seekNextSync = false;
int64_t seekTimeUs;
int retryLimit = 500; // Limit on number of retries before timeout, 10ms per retry
ReadOptions::SeekMode 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",
// (mESSelector == WV_EsSelector_Video) ? "video" : "audio",
// mode, seekTimeUs, options->getLateBy());
@@ -196,7 +203,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
int64_t keyTime;
bool syncFrame;
int retryLimit = 0;
int retryCount = 0;
// 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
@@ -258,7 +265,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
}
if (bytesRead == 0) {
if (retryLimit++ >= 500) {
if (retryCount++ >= retryLimit) {
// If no data received within the retry limit, return ERROR_IO
// This prevents the player from becoming unresponsive
mediaBuf->release();