Fix native fault in WVMMediaSource::DecryptCallback

This change resolves a lifetime issue between the media extractor
and media sources.  The extractor was being passed as a context
object to a callout in the WV libs.  In some cases, a pointer to
the extractor would be delivered to the callout after the extractor
had been released.  This change assigns the responsibility of the
lifetime of the context object to the media source, to ensure that
a ref is always held on the context object during the lifetime of
the media source.

Change-Id: Ic7a57a1c8496a4798fe590ec356b8a19a4f69967
related-to-bug: 6502322
This commit is contained in:
Jeff Tinker
2012-05-16 11:11:14 -07:00
parent 79e250e999
commit e9c40a625c
5 changed files with 89 additions and 43 deletions

View File

@@ -38,14 +38,16 @@ public:
virtual void setAdaptiveStreamingMode(bool adaptive);
bool getAdaptiveStreamingMode() const;
//
// if in CryptoPlugin mode, the extractor doesn't decrypt,
// it just accumulates the ranges of data requiring decryption
// into the MediaBuffer's metadata, the decryption happens
// later via the CryptoPlugin
//
virtual void setCryptoPluginMode(bool cryptoPluginMode);
bool getCryptoPluginMode() const;
virtual void setUID(uid_t uid);
sp<WVMMediaSource> getAudioSource() const { return mAudioSource; }
sp<WVMMediaSource> getVideoSource() const { return mVideoSource; }
static void SocketInfoCallback(int fd, int op, void *context);
static void cleanup();
@@ -63,6 +65,7 @@ private:
sp<WVMFileSource> mFileSource;
sp<DataSource> mDataSource;
sp<WVMInfoListener> mInfoListener;
sp<ClientContext> mClientContext;
bool mHaveMetaData;
bool mUseAdaptiveStreaming;
@@ -73,17 +76,6 @@ private:
status_t mSetupStatus;
bool mUIDIsSet;
uid_t mUID;
//
// if in CryptoPlugin mode, the extractor doesn't decrypt,
// it just accumulates the ranges of data requiring decryption
// into the MediaBuffer's metadata, the decryption happens
// later via the CryptoPlugin
//
bool mCryptoPluginMode;
status_t readMetaData();
const static size_t kStreamCacheSize = 10 * 1024 * 1024;