Propagate errors all the way through the MediaSources and send either MEDIA_PLAYBACK_COMPLETE or MEDIA_ERROR depending on the final reason for running out of buffers to play back.

related-to-bug: 2463749
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 4075ec1..974413d 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1933,6 +1933,7 @@
         CODEC_LOGV("signalling end of input stream.");
         flags |= OMX_BUFFERFLAG_EOS;
 
+        mFinalStatus = err;
         mSignalledEOS = true;
     } else {
         mNoMoreOutputData = false;
@@ -2411,7 +2412,7 @@
     }
 
     if (mFilledBuffers.empty()) {
-        return ERROR_END_OF_STREAM;
+        return mSignalledEOS ? mFinalStatus : ERROR_END_OF_STREAM;
     }
 
     if (mOutputPortSettingsHaveChanged) {