Signal an appropriate error even if there are no active streams yet.
Change-Id: I3ac1053ad288558b62ee18056dfd0a9ce0da8f49
related-to-bug: 5372901
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index 7319e4c..f795654 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -34,7 +34,7 @@
NuPlayer::StreamingSource::StreamingSource(const sp<IStreamSource> &source)
: mSource(source),
- mEOS(false) {
+ mFinalResult(OK) {
}
NuPlayer::StreamingSource::~StreamingSource() {
@@ -47,9 +47,9 @@
mStreamListener->start();
}
-bool NuPlayer::StreamingSource::feedMoreTSData() {
- if (mEOS) {
- return false;
+status_t NuPlayer::StreamingSource::feedMoreTSData() {
+ if (mFinalResult != OK) {
+ return mFinalResult;
}
for (int32_t i = 0; i < 50; ++i) {
@@ -60,7 +60,7 @@
if (n == 0) {
LOGI("input data EOS reached.");
mTSParser->signalEOS(ERROR_END_OF_STREAM);
- mEOS = true;
+ mFinalResult = ERROR_END_OF_STREAM;
break;
} else if (n == INFO_DISCONTINUITY) {
ATSParser::DiscontinuityType type = ATSParser::DISCONTINUITY_SEEK;
@@ -92,14 +92,14 @@
LOGE("TS Parser returned error %d", err);
mTSParser->signalEOS(err);
- mEOS = true;
+ mFinalResult = err;
break;
}
}
}
}
- return true;
+ return OK;
}
sp<MetaData> NuPlayer::StreamingSource::getFormat(bool audio) {