diff options
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 93864e4..7065a6e 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -79,6 +79,21 @@ struct ResourceManagerClient : public BnResourceManagerClient { return (err == OK); } + virtual String8 getName() { + String8 ret; + sp<MediaCodec> codec = mMediaCodec.promote(); + if (codec == NULL) { + // codec is already gone. + return ret; + } + + AString name; + if (codec->getName(&name) == OK) { + ret.setTo(name.c_str()); + } + return ret; + } + protected: virtual ~ResourceManagerClient() {} @@ -139,12 +154,7 @@ sp<IBatteryStats> MediaCodec::BatteryNotifier::getBatteryService_l() { return NULL; } mDeathNotifier = new DeathNotifier(); - if (IInterface::asBinder(mBatteryStatService)-> - linkToDeath(mDeathNotifier) != OK) { - mBatteryStatService.clear(); - mDeathNotifier.clear(); - return NULL; - } + IInterface::asBinder(mBatteryStatService)->linkToDeath(mDeathNotifier); // notify start now if media already started if (mVideoRefCount > 0) { mBatteryStatService->noteStartVideo(AID_MEDIA); @@ -179,8 +189,9 @@ void MediaCodec::BatteryNotifier::noteStopVideo() { return; } - mVideoRefCount--; sp<IBatteryStats> batteryService = getBatteryService_l(); + + mVideoRefCount--; if (mVideoRefCount == 0 && batteryService != NULL) { batteryService->noteStopVideo(AID_MEDIA); } @@ -202,8 +213,9 @@ void MediaCodec::BatteryNotifier::noteStopAudio() { return; } - mAudioRefCount--; sp<IBatteryStats> batteryService = getBatteryService_l(); + + mAudioRefCount--; if (mAudioRefCount == 0 && batteryService != NULL) { batteryService->noteStopAudio(AID_MEDIA); } |