Merge "More instrumentation to track down the hardware decoder not shutting down bug." into honeycomb
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index c0963a6..048f041 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -126,8 +126,6 @@
     virtual status_t    setLooping(int loop) = 0;
     virtual player_type playerType() = 0;
 
-    virtual void        setNotifyCallback(void* cookie, notify_callback_f notifyFunc) {
-                            mCookie = cookie; mNotify = notifyFunc; }
     // Invoke a generic method on the player by using opaque parcels
     // for the request and reply.
     //
@@ -149,9 +147,21 @@
         return INVALID_OPERATION;
     };
 
-    virtual void        sendEvent(int msg, int ext1=0, int ext2=0) { if (mNotify) mNotify(mCookie, msg, ext1, ext2); }
+    void        setNotifyCallback(
+            void* cookie, notify_callback_f notifyFunc) {
+        Mutex::Autolock autoLock(mNotifyLock);
+        mCookie = cookie; mNotify = notifyFunc;
+    }
 
-protected:
+    void        sendEvent(int msg, int ext1=0, int ext2=0) {
+        Mutex::Autolock autoLock(mNotifyLock);
+        if (mNotify) mNotify(mCookie, msg, ext1, ext2);
+    }
+
+private:
+    friend class MediaPlayerService;
+
+    Mutex               mNotifyLock;
     void*               mCookie;
     notify_callback_f   mNotify;
 };
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index adebfe7..7c6e561 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -2203,8 +2203,9 @@
                         crop.right = right;
                         crop.bottom = bottom;
 
-                        CHECK_EQ(0, native_window_set_crop(
-                                    mNativeWindow.get(), &crop));
+                        // We'll ignore any errors here, if the surface is
+                        // already invalid, we'll know soon enough.
+                        native_window_set_crop(mNativeWindow.get(), &crop);
                     }
                 }
             }