OSDN Git Service

Bug 5293383 ~StreamSourceAppProxy wasn't reached
authorGlenn Kasten <gkasten@google.com>
Mon, 12 Sep 2011 14:26:34 +0000 (07:26 -0700)
committerGlenn Kasten <gkasten@google.com>
Mon, 10 Oct 2011 18:58:28 +0000 (11:58 -0700)
commit3adea07faf6124cfbc68d2db80e05f4cced9dfa9
tree158bcc8fb2f1856e2b96ae484c1bac890170641b
parent2102fe47f517fa51e742d816ad0fc5cff65d3e41
Bug 5293383 ~StreamSourceAppProxy wasn't reached

Fix bug where StreamSourceAppProxy destructor wasn't reached,
which caused all sorts of other problems later on.  To see this,
enable the logs StreamSourceAppProxy::~StreamSourceAppProxy and
StreamPlayer::~StreamPlayer.  You'll see that StreamPlayer was destroyed,
but not StreamSourceAppProxy.

As StreamSourceAppProxy is child of StreamPlayer, make the reference
from StreamSourceAppProxy to StreamPlayer a weak reference in case
StreamSourceAppProxy's lifetime exceeds StreamPlayer.  It is not supposed
to any more with this fix, but the wp<> provides extra safety.

StreamPlayer preDestroy no longer bypasses the preDestroy in
GenericMediaPlayer.

Do a full disconnect in GenericMediaPlayer::preDestroy.

Push decremented reference counts for strong pointer through binder
to workaround binder's "optimization".

Extra error-checking in setListener and setBuffers to verify
that mediaserver is calling them correctly.

Use mutex mLock consistently in StreamSourceAppProxy.

Add an explicit StreamSourceAppProxy::disconnect to break
a circular reference, and call it in StreamPlayer destructor.

Make methods private: receivedCmd_l and receivedBuffer_l.

Add explicit clear during preDestroy to give up references earlier.

Warning: setDataSource(NULL) is not supported by NuPlayer yet,
this depends on another change in frameworks/base, so it is
commented out for now.

Rename mPlayerPrepared to mPreparedPlayer to avoid confusion with the
enum mPlayerPrepared.

Change-Id: Ie5f554c206027d22204eb86edd15489c6281b512
wilhelm/src/android/android_GenericMediaPlayer.cpp
wilhelm/src/android/android_GenericMediaPlayer.h
wilhelm/src/android/android_StreamPlayer.cpp
wilhelm/src/android/android_StreamPlayer.h