Merge "Propagate error signalled by the source all the way to the output EOS notification."
This commit is contained in:
committed by
Android (Google) Code Review
commit
48719dc622
@@ -113,6 +113,7 @@ private:
|
|||||||
|
|
||||||
Vector<BufferInfo> mBuffers[2];
|
Vector<BufferInfo> mBuffers[2];
|
||||||
bool mPortEOS[2];
|
bool mPortEOS[2];
|
||||||
|
status_t mInputEOSResult;
|
||||||
|
|
||||||
List<sp<AMessage> > mDeferredQueue;
|
List<sp<AMessage> > mDeferredQueue;
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,11 @@ bool NuPlayer::HTTPLiveSource::feedMoreTSData() {
|
|||||||
if (n == -EWOULDBLOCK) {
|
if (n == -EWOULDBLOCK) {
|
||||||
break;
|
break;
|
||||||
} else if (n < 0) {
|
} else if (n < 0) {
|
||||||
LOGI("input data EOS reached.");
|
if (n != ERROR_END_OF_STREAM) {
|
||||||
|
LOGI("input data EOS reached, error %d", n);
|
||||||
|
} else {
|
||||||
|
LOGI("input data EOS reached.");
|
||||||
|
}
|
||||||
mTSParser->signalEOS(n);
|
mTSParser->signalEOS(n);
|
||||||
mEOS = true;
|
mEOS = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -272,7 +272,18 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (what == ACodec::kWhatEOS) {
|
} else if (what == ACodec::kWhatEOS) {
|
||||||
mRenderer->queueEOS(audio, ERROR_END_OF_STREAM);
|
int32_t err;
|
||||||
|
CHECK(codecRequest->findInt32("err", &err));
|
||||||
|
|
||||||
|
if (err == ERROR_END_OF_STREAM) {
|
||||||
|
LOGV("got %s decoder EOS", audio ? "audio" : "video");
|
||||||
|
} else {
|
||||||
|
LOGV("got %s decoder EOS w/ error %d",
|
||||||
|
audio ? "audio" : "video",
|
||||||
|
err);
|
||||||
|
}
|
||||||
|
|
||||||
|
mRenderer->queueEOS(audio, err);
|
||||||
} else if (what == ACodec::kWhatFlushCompleted) {
|
} else if (what == ACodec::kWhatFlushCompleted) {
|
||||||
bool needShutdown;
|
bool needShutdown;
|
||||||
|
|
||||||
@@ -397,7 +408,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
|
|||||||
if (finalResult == ERROR_END_OF_STREAM) {
|
if (finalResult == ERROR_END_OF_STREAM) {
|
||||||
LOGV("reached %s EOS", audio ? "audio" : "video");
|
LOGV("reached %s EOS", audio ? "audio" : "video");
|
||||||
} else {
|
} else {
|
||||||
LOGE("%s track encountered an error (0x%08x)",
|
LOGE("%s track encountered an error (%d)",
|
||||||
audio ? "audio" : "video", finalResult);
|
audio ? "audio" : "video", finalResult);
|
||||||
|
|
||||||
notifyListener(
|
notifyListener(
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ ACodec::ACodec()
|
|||||||
mFlushingState = new FlushingState(this);
|
mFlushingState = new FlushingState(this);
|
||||||
|
|
||||||
mPortEOS[kPortIndexInput] = mPortEOS[kPortIndexOutput] = false;
|
mPortEOS[kPortIndexInput] = mPortEOS[kPortIndexOutput] = false;
|
||||||
|
mInputEOSResult = OK;
|
||||||
|
|
||||||
changeState(mUninitializedState);
|
changeState(mUninitializedState);
|
||||||
}
|
}
|
||||||
@@ -1347,7 +1348,10 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) {
|
|||||||
case KEEP_BUFFERS:
|
case KEEP_BUFFERS:
|
||||||
{
|
{
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
mCodec->mPortEOS[kPortIndexInput] = true;
|
if (!mCodec->mPortEOS[kPortIndexInput]) {
|
||||||
|
mCodec->mPortEOS[kPortIndexInput] = true;
|
||||||
|
mCodec->mInputEOSResult = err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1398,8 +1402,14 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) {
|
|||||||
|
|
||||||
getMoreInputDataIfPossible();
|
getMoreInputDataIfPossible();
|
||||||
} else if (!mCodec->mPortEOS[kPortIndexInput]) {
|
} else if (!mCodec->mPortEOS[kPortIndexInput]) {
|
||||||
LOGV("[%s] Signalling EOS on the input port",
|
if (err != ERROR_END_OF_STREAM) {
|
||||||
mCodec->mComponentName.c_str());
|
LOGV("[%s] Signalling EOS on the input port "
|
||||||
|
"due to error %d",
|
||||||
|
mCodec->mComponentName.c_str(), err);
|
||||||
|
} else {
|
||||||
|
LOGV("[%s] Signalling EOS on the input port",
|
||||||
|
mCodec->mComponentName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
LOGV("[%s] calling emptyBuffer %p signalling EOS",
|
LOGV("[%s] calling emptyBuffer %p signalling EOS",
|
||||||
mCodec->mComponentName.c_str(), bufferID);
|
mCodec->mComponentName.c_str(), bufferID);
|
||||||
@@ -1416,6 +1426,7 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) {
|
|||||||
info->mStatus = BufferInfo::OWNED_BY_COMPONENT;
|
info->mStatus = BufferInfo::OWNED_BY_COMPONENT;
|
||||||
|
|
||||||
mCodec->mPortEOS[kPortIndexInput] = true;
|
mCodec->mPortEOS[kPortIndexInput] = true;
|
||||||
|
mCodec->mInputEOSResult = err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1523,6 +1534,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(
|
|||||||
if (flags & OMX_BUFFERFLAG_EOS) {
|
if (flags & OMX_BUFFERFLAG_EOS) {
|
||||||
sp<AMessage> notify = mCodec->mNotify->dup();
|
sp<AMessage> notify = mCodec->mNotify->dup();
|
||||||
notify->setInt32("what", ACodec::kWhatEOS);
|
notify->setInt32("what", ACodec::kWhatEOS);
|
||||||
|
notify->setInt32("err", mCodec->mInputEOSResult);
|
||||||
notify->post();
|
notify->post();
|
||||||
|
|
||||||
mCodec->mPortEOS[kPortIndexOutput] = true;
|
mCodec->mPortEOS[kPortIndexOutput] = true;
|
||||||
@@ -1721,6 +1733,8 @@ void ACodec::UninitializedState::onSetup(
|
|||||||
mCodec->mPortEOS[kPortIndexInput] =
|
mCodec->mPortEOS[kPortIndexInput] =
|
||||||
mCodec->mPortEOS[kPortIndexOutput] = false;
|
mCodec->mPortEOS[kPortIndexOutput] = false;
|
||||||
|
|
||||||
|
mCodec->mInputEOSResult = OK;
|
||||||
|
|
||||||
mCodec->configureCodec(mime.c_str(), msg);
|
mCodec->configureCodec(mime.c_str(), msg);
|
||||||
|
|
||||||
sp<RefBase> obj;
|
sp<RefBase> obj;
|
||||||
@@ -2371,6 +2385,8 @@ void ACodec::FlushingState::changeStateIfWeOwnAllBuffers() {
|
|||||||
mCodec->mPortEOS[kPortIndexInput] =
|
mCodec->mPortEOS[kPortIndexInput] =
|
||||||
mCodec->mPortEOS[kPortIndexOutput] = false;
|
mCodec->mPortEOS[kPortIndexOutput] = false;
|
||||||
|
|
||||||
|
mCodec->mInputEOSResult = OK;
|
||||||
|
|
||||||
mCodec->changeState(mCodec->mExecutingState);
|
mCodec->changeState(mCodec->mExecutingState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user