Loading include/media/stagefright/MediaCodec.h +5 −3 Original line number Diff line number Diff line Loading @@ -64,14 +64,15 @@ struct MediaCodec : public AHandler { }; static const pid_t kNoPid = -1; static const uid_t kNoUid = -1; static sp<MediaCodec> CreateByType( const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err = NULL, pid_t pid = kNoPid); pid_t pid = kNoPid, uid_t uid = kNoUid); static sp<MediaCodec> CreateByComponentName( const sp<ALooper> &looper, const AString &name, status_t *err = NULL, pid_t pid = kNoPid); pid_t pid = kNoPid, uid_t uid = kNoUid); static sp<PersistentSurface> CreatePersistentInputSurface(); Loading Loading @@ -286,6 +287,7 @@ private: }; State mState; uid_t mUid; bool mReleasedByResourceManager; sp<ALooper> mLooper; sp<ALooper> mCodecLooper; Loading Loading @@ -345,7 +347,7 @@ private: bool mHaveInputSurface; bool mHavePendingInputBuffers; MediaCodec(const sp<ALooper> &looper, pid_t pid); MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid); static sp<CodecBase> GetCodecBase(const AString &name, bool nameIsType = false); Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1641,7 +1641,7 @@ status_t NuPlayer::instantiateDecoder( } else { mSource->setOffloadAudio(false /* offload */); *decoder = new Decoder(notify, mSource, mPID, mRenderer); *decoder = new Decoder(notify, mSource, mPID, mUID, mRenderer); } } else { sp<AMessage> notify = new AMessage(kWhatVideoNotify, this); Loading @@ -1649,7 +1649,7 @@ status_t NuPlayer::instantiateDecoder( notify->setInt32("generation", mVideoDecoderGeneration); *decoder = new Decoder( notify, mSource, mPID, mRenderer, mSurface, mCCDecoder); notify, mSource, mPID, mUID, mRenderer, mSurface, mCCDecoder); // enable FRC if high-quality AV sync is requested, even if not // directly queuing to display, as this will even improve textureview Loading media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ NuPlayer::Decoder::Decoder( const sp<AMessage> ¬ify, const sp<Source> &source, pid_t pid, uid_t uid, const sp<Renderer> &renderer, const sp<Surface> &surface, const sp<CCDecoder> &ccDecoder) Loading @@ -67,6 +68,7 @@ NuPlayer::Decoder::Decoder( mRenderer(renderer), mCCDecoder(ccDecoder), mPid(pid), mUid(uid), mSkipRenderingUntilMediaTimeUs(-1ll), mNumFramesTotal(0ll), mNumInputFramesDropped(0ll), Loading Loading @@ -266,7 +268,7 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { ALOGV("[%s] onConfigure (surface=%p)", mComponentName.c_str(), mSurface.get()); mCodec = MediaCodec::CreateByType( mCodecLooper, mime.c_str(), false /* encoder */, NULL /* err */, mPid); mCodecLooper, mime.c_str(), false /* encoder */, NULL /* err */, mPid, mUid); int32_t secure = 0; if (format->findInt32("secure", &secure) && secure != 0) { if (mCodec != NULL) { Loading @@ -275,7 +277,7 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { mCodec->release(); ALOGI("[%s] creating", mComponentName.c_str()); mCodec = MediaCodec::CreateByComponentName( mCodecLooper, mComponentName.c_str(), NULL /* err */, mPid); mCodecLooper, mComponentName.c_str(), NULL /* err */, mPid, mUid); } } if (mCodec == NULL) { Loading media/libmediaplayerservice/nuplayer/NuPlayerDecoder.h +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ struct NuPlayer::Decoder : public DecoderBase { Decoder(const sp<AMessage> ¬ify, const sp<Source> &source, pid_t pid, uid_t uid, const sp<Renderer> &renderer = NULL, const sp<Surface> &surface = NULL, const sp<CCDecoder> &ccDecoder = NULL); Loading Loading @@ -85,6 +86,7 @@ private: Vector<size_t> mDequeuedInputBuffers; const pid_t mPid; const uid_t mUid; int64_t mSkipRenderingUntilMediaTimeUs; int64_t mNumFramesTotal; int64_t mNumInputFramesDropped; Loading media/libstagefright/MediaCodec.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -173,8 +173,9 @@ bool MediaCodec::ResourceManagerServiceProxy::reclaimResource( // static sp<MediaCodec> MediaCodec::CreateByType( const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err, pid_t pid) { sp<MediaCodec> codec = new MediaCodec(looper, pid); const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err, pid_t pid, uid_t uid) { sp<MediaCodec> codec = new MediaCodec(looper, pid, uid); const status_t ret = codec->init(mime, true /* nameIsType */, encoder); if (err != NULL) { Loading @@ -185,8 +186,8 @@ sp<MediaCodec> MediaCodec::CreateByType( // static sp<MediaCodec> MediaCodec::CreateByComponentName( const sp<ALooper> &looper, const AString &name, status_t *err, pid_t pid) { sp<MediaCodec> codec = new MediaCodec(looper, pid); const sp<ALooper> &looper, const AString &name, status_t *err, pid_t pid, uid_t uid) { sp<MediaCodec> codec = new MediaCodec(looper, pid, uid); const status_t ret = codec->init(name, false /* nameIsType */, false /* encoder */); if (err != NULL) { Loading Loading @@ -234,7 +235,7 @@ sp<PersistentSurface> MediaCodec::CreatePersistentInputSurface() { return new PersistentSurface(bufferProducer, bufferSource); } MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid) MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid) : mState(UNINITIALIZED), mReleasedByResourceManager(false), mLooper(looper), Loading @@ -256,6 +257,11 @@ MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid) mDequeueOutputReplyID(0), mHaveInputSurface(false), mHavePendingInputBuffers(false) { if (uid == kNoUid) { mUid = IPCThreadState::self()->getCallingUid(); } else { mUid = uid; } } MediaCodec::~MediaCodec() { Loading Loading @@ -2904,10 +2910,10 @@ void MediaCodec::updateBatteryStat() { } if (mState == CONFIGURED && !mBatteryStatNotified) { BatteryNotifier::getInstance().noteStartVideo(); BatteryNotifier::getInstance().noteStartVideo(mUid); mBatteryStatNotified = true; } else if (mState == UNINITIALIZED && mBatteryStatNotified) { BatteryNotifier::getInstance().noteStopVideo(); BatteryNotifier::getInstance().noteStopVideo(mUid); mBatteryStatNotified = false; } } Loading Loading
include/media/stagefright/MediaCodec.h +5 −3 Original line number Diff line number Diff line Loading @@ -64,14 +64,15 @@ struct MediaCodec : public AHandler { }; static const pid_t kNoPid = -1; static const uid_t kNoUid = -1; static sp<MediaCodec> CreateByType( const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err = NULL, pid_t pid = kNoPid); pid_t pid = kNoPid, uid_t uid = kNoUid); static sp<MediaCodec> CreateByComponentName( const sp<ALooper> &looper, const AString &name, status_t *err = NULL, pid_t pid = kNoPid); pid_t pid = kNoPid, uid_t uid = kNoUid); static sp<PersistentSurface> CreatePersistentInputSurface(); Loading Loading @@ -286,6 +287,7 @@ private: }; State mState; uid_t mUid; bool mReleasedByResourceManager; sp<ALooper> mLooper; sp<ALooper> mCodecLooper; Loading Loading @@ -345,7 +347,7 @@ private: bool mHaveInputSurface; bool mHavePendingInputBuffers; MediaCodec(const sp<ALooper> &looper, pid_t pid); MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid); static sp<CodecBase> GetCodecBase(const AString &name, bool nameIsType = false); Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1641,7 +1641,7 @@ status_t NuPlayer::instantiateDecoder( } else { mSource->setOffloadAudio(false /* offload */); *decoder = new Decoder(notify, mSource, mPID, mRenderer); *decoder = new Decoder(notify, mSource, mPID, mUID, mRenderer); } } else { sp<AMessage> notify = new AMessage(kWhatVideoNotify, this); Loading @@ -1649,7 +1649,7 @@ status_t NuPlayer::instantiateDecoder( notify->setInt32("generation", mVideoDecoderGeneration); *decoder = new Decoder( notify, mSource, mPID, mRenderer, mSurface, mCCDecoder); notify, mSource, mPID, mUID, mRenderer, mSurface, mCCDecoder); // enable FRC if high-quality AV sync is requested, even if not // directly queuing to display, as this will even improve textureview Loading
media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ NuPlayer::Decoder::Decoder( const sp<AMessage> ¬ify, const sp<Source> &source, pid_t pid, uid_t uid, const sp<Renderer> &renderer, const sp<Surface> &surface, const sp<CCDecoder> &ccDecoder) Loading @@ -67,6 +68,7 @@ NuPlayer::Decoder::Decoder( mRenderer(renderer), mCCDecoder(ccDecoder), mPid(pid), mUid(uid), mSkipRenderingUntilMediaTimeUs(-1ll), mNumFramesTotal(0ll), mNumInputFramesDropped(0ll), Loading Loading @@ -266,7 +268,7 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { ALOGV("[%s] onConfigure (surface=%p)", mComponentName.c_str(), mSurface.get()); mCodec = MediaCodec::CreateByType( mCodecLooper, mime.c_str(), false /* encoder */, NULL /* err */, mPid); mCodecLooper, mime.c_str(), false /* encoder */, NULL /* err */, mPid, mUid); int32_t secure = 0; if (format->findInt32("secure", &secure) && secure != 0) { if (mCodec != NULL) { Loading @@ -275,7 +277,7 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) { mCodec->release(); ALOGI("[%s] creating", mComponentName.c_str()); mCodec = MediaCodec::CreateByComponentName( mCodecLooper, mComponentName.c_str(), NULL /* err */, mPid); mCodecLooper, mComponentName.c_str(), NULL /* err */, mPid, mUid); } } if (mCodec == NULL) { Loading
media/libmediaplayerservice/nuplayer/NuPlayerDecoder.h +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ struct NuPlayer::Decoder : public DecoderBase { Decoder(const sp<AMessage> ¬ify, const sp<Source> &source, pid_t pid, uid_t uid, const sp<Renderer> &renderer = NULL, const sp<Surface> &surface = NULL, const sp<CCDecoder> &ccDecoder = NULL); Loading Loading @@ -85,6 +86,7 @@ private: Vector<size_t> mDequeuedInputBuffers; const pid_t mPid; const uid_t mUid; int64_t mSkipRenderingUntilMediaTimeUs; int64_t mNumFramesTotal; int64_t mNumInputFramesDropped; Loading
media/libstagefright/MediaCodec.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -173,8 +173,9 @@ bool MediaCodec::ResourceManagerServiceProxy::reclaimResource( // static sp<MediaCodec> MediaCodec::CreateByType( const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err, pid_t pid) { sp<MediaCodec> codec = new MediaCodec(looper, pid); const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err, pid_t pid, uid_t uid) { sp<MediaCodec> codec = new MediaCodec(looper, pid, uid); const status_t ret = codec->init(mime, true /* nameIsType */, encoder); if (err != NULL) { Loading @@ -185,8 +186,8 @@ sp<MediaCodec> MediaCodec::CreateByType( // static sp<MediaCodec> MediaCodec::CreateByComponentName( const sp<ALooper> &looper, const AString &name, status_t *err, pid_t pid) { sp<MediaCodec> codec = new MediaCodec(looper, pid); const sp<ALooper> &looper, const AString &name, status_t *err, pid_t pid, uid_t uid) { sp<MediaCodec> codec = new MediaCodec(looper, pid, uid); const status_t ret = codec->init(name, false /* nameIsType */, false /* encoder */); if (err != NULL) { Loading Loading @@ -234,7 +235,7 @@ sp<PersistentSurface> MediaCodec::CreatePersistentInputSurface() { return new PersistentSurface(bufferProducer, bufferSource); } MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid) MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid, uid_t uid) : mState(UNINITIALIZED), mReleasedByResourceManager(false), mLooper(looper), Loading @@ -256,6 +257,11 @@ MediaCodec::MediaCodec(const sp<ALooper> &looper, pid_t pid) mDequeueOutputReplyID(0), mHaveInputSurface(false), mHavePendingInputBuffers(false) { if (uid == kNoUid) { mUid = IPCThreadState::self()->getCallingUid(); } else { mUid = uid; } } MediaCodec::~MediaCodec() { Loading Loading @@ -2904,10 +2910,10 @@ void MediaCodec::updateBatteryStat() { } if (mState == CONFIGURED && !mBatteryStatNotified) { BatteryNotifier::getInstance().noteStartVideo(); BatteryNotifier::getInstance().noteStartVideo(mUid); mBatteryStatNotified = true; } else if (mState == UNINITIALIZED && mBatteryStatNotified) { BatteryNotifier::getInstance().noteStopVideo(); BatteryNotifier::getInstance().noteStopVideo(mUid); mBatteryStatNotified = false; } } Loading