diff options
author | Andreas Huber <andih@google.com> | 2011-01-26 11:44:17 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-26 11:44:17 -0800 |
commit | 86ba757ddf906a7b59f0dbba9a2197d823650050 (patch) | |
tree | 2d088df9318bd8fa1746c3d77e4d4e0186fffaa8 /include | |
parent | b7b1486bd55f9fe27f15724452f748045d204fb1 (diff) | |
parent | d3455c0d28c7b663ada8db188aa8dc0a3979e496 (diff) | |
download | frameworks_av-86ba757ddf906a7b59f0dbba9a2197d823650050.zip frameworks_av-86ba757ddf906a7b59f0dbba9a2197d823650050.tar.gz frameworks_av-86ba757ddf906a7b59f0dbba9a2197d823650050.tar.bz2 |
am a9f27fa6: Merge "Protect notification callback parameters with a mutex." into honeycomb
* commit 'a9f27fa631ab21d52c75842ccaacc1cbcd75fca0':
Protect notification callback parameters with a mutex.
Diffstat (limited to 'include')
-rw-r--r-- | include/media/MediaPlayerInterface.h | 18 |
1 files changed, 14 insertions, 4 deletions
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 @@ public: 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 @@ public: 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; }; |