Merge "connect/disconnect is now called from our EGL wrapper"
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 020e947..8a42e8b 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -188,7 +188,7 @@
}
size_t endOffset = offset - 2;
- while (data[endOffset - 1] == 0x00) {
+ while (endOffset > startOffset + 1 && data[endOffset - 1] == 0x00) {
--endOffset;
}
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 90d64ba..2578d2d 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -544,6 +544,7 @@
firstSeqNumberInPlaylist = 0;
}
+ bool seekDiscontinuity = false;
bool explicitDiscontinuity = false;
bool bandwidthChanged = false;
@@ -580,10 +581,10 @@
// reseting the data source will have had the
// side effect of discarding any previously queued
// bandwidth change discontinuity.
- // Therefore we'll need to treat these explicit
+ // Therefore we'll need to treat these seek
// discontinuities as involving a bandwidth change
// even if they aren't directly.
- explicitDiscontinuity = true;
+ seekDiscontinuity = true;
bandwidthChanged = true;
}
}
@@ -597,11 +598,7 @@
}
if (mSeqNumber < 0) {
- if (mPlaylist->isComplete()) {
- mSeqNumber = firstSeqNumberInPlaylist;
- } else {
- mSeqNumber = firstSeqNumberInPlaylist + mPlaylist->size() / 2;
- }
+ mSeqNumber = firstSeqNumberInPlaylist;
}
int32_t lastSeqNumberInPlaylist =
@@ -704,15 +701,17 @@
bandwidthChanged = false;
}
- if (explicitDiscontinuity || bandwidthChanged) {
+ if (seekDiscontinuity || explicitDiscontinuity || bandwidthChanged) {
// Signal discontinuity.
- LOGI("queueing discontinuity (explicit=%d, bandwidthChanged=%d)",
- explicitDiscontinuity, bandwidthChanged);
+ LOGI("queueing discontinuity (seek=%d, explicit=%d, bandwidthChanged=%d)",
+ seekDiscontinuity, explicitDiscontinuity, bandwidthChanged);
sp<ABuffer> tmp = new ABuffer(188);
memset(tmp->data(), 0, tmp->size());
- tmp->data()[1] = bandwidthChanged;
+
+ // signal a 'hard' discontinuity for explicit or bandwidthChanged.
+ tmp->data()[1] = (explicitDiscontinuity || bandwidthChanged) ? 1 : 0;
mDataSource->queueBuffer(tmp);
}