• Glenn Kasten's avatar
    Bug 5334969 MediaPlayerNotificationClient safety · 91ff087f
    Glenn Kasten authored
    Fixed race due to missing mutex around 2 updates to mPlayerPrepared.
    
    MediaPlayerNotificationClient had a raw reference to GenericMediaPlayer;
    if for some reason the binder thread out-lived the GenericMediaPlayer,
    then it might reference a destroyed object.  Made it a weak reference,
    and issue warning if the GenericMediaPlayer has been destroyed.
    This has similar effect as a callback protector.
    
    Minor related:
     - mHasVideo is read without mutex, safe since never changed but make it const
     - GenericMediaPlayer's reference to MediaPlayerNotificationClient is now const also
    
    Change-Id: I67b50e861a055c73fd490fb537a3d6d23d25c3d2
    91ff087f
android_GenericMediaPlayer.cpp 17.5 KB