Merge "Notify the playback status to DRM agents before the playback starts"
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 9789e36..781e3fc 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -526,6 +526,13 @@
 
     bool deferredAudioSeek = false;
 
+    if (mDecryptHandle != NULL) {
+        int64_t position;
+        getPosition(&position);
+        mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
+                Playback::START, position / 1000);
+    }
+
     if (mAudioSource != NULL) {
         if (mAudioPlayer == NULL) {
             if (mAudioSink != NULL) {
@@ -543,6 +550,11 @@
 
                     mFlags &= ~(PLAYING | FIRST_FRAME);
 
+                    if (mDecryptHandle != NULL) {
+                        mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
+                                 Playback::STOP, 0);
+                    }
+
                     return err;
                 }
 
@@ -582,13 +594,6 @@
         seekTo_l(0);
     }
 
-    if (mDecryptHandle != NULL) {
-        int64_t position;
-        getPosition(&position);
-        mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
-                Playback::START, position / 1000);
-    }
-
     return OK;
 }