summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-08-04 12:02:47 -0700
committerAndreas Huber <andih@google.com>2011-08-04 12:10:29 -0700
commit323e31754c3ba31e537e712e818f90381b8eb6d1 (patch)
tree7b3debad8fd59463eac53c12e15faffda869fb8b /media/libstagefright
parentf91f0905e43e9e264348adb5d3d5f18a8777ff55 (diff)
downloadframeworks_base-323e31754c3ba31e537e712e818f90381b8eb6d1.zip
frameworks_base-323e31754c3ba31e537e712e818f90381b8eb6d1.tar.gz
frameworks_base-323e31754c3ba31e537e712e818f90381b8eb6d1.tar.bz2
Restart HLS streaming from the bottom of the playlist if we miss the boat on the
next segment. This can happen if for whatever reason we playback video slower than it is served. Also removed some unnecessary verbosity from ChromiumHTTPDataSource. Change-Id: I6e870879310c9efe4d50d7dc0883c08405442d79 related-to-bug: 5120425
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/chromium_http/support.cpp10
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp35
2 files changed, 27 insertions, 18 deletions
diff --git a/media/libstagefright/chromium_http/support.cpp b/media/libstagefright/chromium_http/support.cpp
index eb10ab7..26c3eda 100644
--- a/media/libstagefright/chromium_http/support.cpp
+++ b/media/libstagefright/chromium_http/support.cpp
@@ -183,19 +183,19 @@ void SfDelegate::setOwner(ChromiumHTTPDataSource *owner) {
void SfDelegate::OnReceivedRedirect(
net::URLRequest *request, const GURL &new_url, bool *defer_redirect) {
- MY_LOGI("OnReceivedRedirect");
+ MY_LOGV("OnReceivedRedirect");
}
void SfDelegate::OnAuthRequired(
net::URLRequest *request, net::AuthChallengeInfo *auth_info) {
- MY_LOGI("OnAuthRequired");
+ MY_LOGV("OnAuthRequired");
inherited::OnAuthRequired(request, auth_info);
}
void SfDelegate::OnCertificateRequested(
net::URLRequest *request, net::SSLCertRequestInfo *cert_request_info) {
- MY_LOGI("OnCertificateRequested");
+ MY_LOGV("OnCertificateRequested");
inherited::OnCertificateRequested(request, cert_request_info);
}
@@ -208,7 +208,7 @@ void SfDelegate::OnSSLCertificateError(
}
void SfDelegate::OnGetCookies(net::URLRequest *request, bool blocked_by_policy) {
- MY_LOGI("OnGetCookies");
+ MY_LOGV("OnGetCookies");
}
void SfDelegate::OnSetCookie(
@@ -216,7 +216,7 @@ void SfDelegate::OnSetCookie(
const std::string &cookie_line,
const net::CookieOptions &options,
bool blocked_by_policy) {
- MY_LOGI("OnSetCookie");
+ MY_LOGV("OnSetCookie");
}
void SfDelegate::OnResponseStarted(net::URLRequest *request) {
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 2578d2d..f67cdac 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -617,23 +617,32 @@ rinse_repeat:
goto rinse_repeat;
}
- if (!mPlaylist->isComplete()
- && mSeqNumber > lastSeqNumberInPlaylist
- && mNumRetries < kMaxNumRetries) {
+ if (!mPlaylist->isComplete() && mNumRetries < kMaxNumRetries) {
++mNumRetries;
- mLastPlaylistFetchTimeUs = -1;
- postMonitorQueue(3000000ll);
- return;
- }
+ if (mSeqNumber > lastSeqNumberInPlaylist) {
+ mLastPlaylistFetchTimeUs = -1;
+ postMonitorQueue(3000000ll);
+ return;
+ }
- LOGE("Cannot find sequence number %d in playlist "
- "(contains %d - %d)",
- mSeqNumber, firstSeqNumberInPlaylist,
- firstSeqNumberInPlaylist + mPlaylist->size() - 1);
+ // we've missed the boat, let's start from the lowest sequence
+ // number available and signal a discontinuity.
- mDataSource->queueEOS(ERROR_END_OF_STREAM);
- return;
+ LOGI("We've missed the boat, restarting playback.");
+ mSeqNumber = lastSeqNumberInPlaylist;
+ explicitDiscontinuity = true;
+
+ // fall through
+ } else {
+ LOGE("Cannot find sequence number %d in playlist "
+ "(contains %d - %d)",
+ mSeqNumber, firstSeqNumberInPlaylist,
+ firstSeqNumberInPlaylist + mPlaylist->size() - 1);
+
+ mDataSource->queueEOS(ERROR_END_OF_STREAM);
+ return;
+ }
}
mNumRetries = 0;