Propagate error signalled by the source all the way to the output EOS notification.

Change-Id: I30e959a6d669f09745c59fbdebee08f869511cf7
related-to-bug: 5372901
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 7218faf..7bfd358 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -272,7 +272,18 @@
                     }
                 }
             } 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) {
                 bool needShutdown;
 
@@ -397,7 +408,7 @@
                 if (finalResult == ERROR_END_OF_STREAM) {
                     LOGV("reached %s EOS", audio ? "audio" : "video");
                 } else {
-                    LOGE("%s track encountered an error (0x%08x)",
+                    LOGE("%s track encountered an error (%d)",
                          audio ? "audio" : "video", finalResult);
 
                     notifyListener(