Bug 996688 - Prevent potential crash in RtspConnectionHandler::parsePlayResponse. r=sworkman

This commit is contained in:
Ethan Tseng 2014-04-16 00:59:30 +08:00
Родитель c96c46a130
Коммит 1531ef0eaf
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -126,6 +126,7 @@ struct RtspConnectionHandler : public AHandler {
mSetupTracksSuccessful(false),
mSeekPending(false),
mPausePending(false),
mAborted(false),
mFirstAccessUnit(true),
mNTPAnchorUs(-1),
mMediaAnchorUs(-1),
@ -412,6 +413,7 @@ struct RtspConnectionHandler : public AHandler {
{
int32_t result;
CHECK(msg->findInt32("result", &result));
mAborted = false;
LOGI("connection request completed with result %d (%s)",
result, strerror(-result));
@ -459,6 +461,10 @@ struct RtspConnectionHandler : public AHandler {
LOGI("DESCRIBE completed with result %d (%s)",
result, strerror(-result));
if (mAborted) {
LOGV("we're aborted, dropping stale packet.");
break;
}
if (result == OK) {
sp<RefBase> obj;
@ -578,6 +584,10 @@ struct RtspConnectionHandler : public AHandler {
LOGI("SETUP(%d) completed with result %d (%s)",
index, result, strerror(-result));
if (mAborted) {
LOGV("we're aborted, dropping stale packet.");
break;
}
if (result == OK) {
CHECK(track != NULL);
@ -711,6 +721,10 @@ struct RtspConnectionHandler : public AHandler {
LOGI("PLAY completed with result %d (%s)",
result, strerror(-result));
if (mAborted) {
LOGV("we're aborted, dropping stale packet.");
break;
}
if (result == OK) {
sp<RefBase> obj;
@ -816,6 +830,7 @@ struct RtspConnectionHandler : public AHandler {
mReceivedFirstRTCPPacket = false;
mReceivedFirstRTPPacket = false;
mSeekable = false;
mAborted = true;
sp<AMessage> reply = new AMessage('tear', id());
@ -955,6 +970,11 @@ struct RtspConnectionHandler : public AHandler {
break;
}
if (mAborted) {
LOGV("we're aborted, dropping stale packet.");
break;
}
if (seqNum < track->mFirstSeqNumInSegment) {
LOGV("dropping stale access-unit (%d < %d)",
seqNum, track->mFirstSeqNumInSegment);
@ -1047,6 +1067,10 @@ struct RtspConnectionHandler : public AHandler {
LOGI("PLAY completed with result %d (%s)",
result, strerror(-result));
if (mAborted) {
LOGV("we're aborted, dropping stale packet.");
break;
}
mCheckPending = false;
postAccessUnitTimeoutCheck();
@ -1301,6 +1325,7 @@ private:
bool mSetupTracksSuccessful;
bool mSeekPending;
bool mPausePending;
bool mAborted;
bool mFirstAccessUnit;
int64_t mNTPAnchorUs;