DashPlayer: Fix to address following issues in DashPlayer

 - Notify MEDIA_PREPARED after media duration is notified.
 - Not to notify Playback complete if Media Error is notified

Change-Id: If3cc16d0f7b404c4071b17ba0955d044c0266267
diff --git a/dashplayer/DashPlayer.cpp b/dashplayer/DashPlayer.cpp
index d244792..ec649a1 100644
--- a/dashplayer/DashPlayer.cpp
+++ b/dashplayer/DashPlayer.cpp
@@ -564,7 +564,12 @@
 
                 if ((mAudioEOS || mAudioDecoder == NULL)
                         && (mVideoEOS || mVideoDecoder == NULL)) {
-                    notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
+                      if ((mSourceType == kHttpDashSource) &&
+                          (finalResult == ERROR_END_OF_STREAM)) {
+                           notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
+                      } else if (mSourceType != kHttpDashSource) {
+                         notifyListener(MEDIA_PLAYBACK_COMPLETE, 0, 0);
+                      }
                 }
             } else if (what == Renderer::kWhatPosition) {
                 int64_t positionUs;
@@ -813,7 +818,6 @@
                 break;
             }
             if (mSource->isPrepareDone()) {
-                notifyListener(MEDIA_PREPARED, 0, 0);
                 int64_t durationUs;
                 if (mDriver != NULL && mSource->getDuration(&durationUs) == OK) {
                     sp<DashPlayerDriver> driver = mDriver.promote();
@@ -821,6 +825,7 @@
                         driver->notifyDuration(durationUs);
                     }
                 }
+                notifyListener(MEDIA_PREPARED, 0, 0);
             } else {
                 msg->post(100000ll);
             }