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/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 7bfd358..6b40528 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -235,11 +235,17 @@
instantiateDecoder(true, &mAudioDecoder);
}
- if (!mSource->feedMoreTSData()) {
+ status_t err;
+ if ((err = mSource->feedMoreTSData()) != OK) {
if (mAudioDecoder == NULL && mVideoDecoder == NULL) {
// We're not currently decoding anything (no audio or
// video tracks found) and we just ran out of input data.
- notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
+
+ if (err == ERROR_END_OF_STREAM) {
+ notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
+ } else {
+ notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
+ }
}
break;
}
@@ -267,7 +273,7 @@
audio, codecRequest);
if (err == -EWOULDBLOCK) {
- if (mSource->feedMoreTSData()) {
+ if (mSource->feedMoreTSData() == OK) {
msg->post();
}
}