Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45c765da authored by Chong Zhang's avatar Chong Zhang
Browse files

MediaCodec: ignore error when linkToDeath to batterystats

bug: 20071299
Change-Id: I932b40e46312db467fe88f8ff6cea028b63785cd
parent 04f07fd6
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -139,12 +139,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 +174,9 @@ void MediaCodec::BatteryNotifier::noteStopVideo() {
        return;
    }

    mVideoRefCount--;
    sp<IBatteryStats> batteryService = getBatteryService_l();

    mVideoRefCount--;
    if (mVideoRefCount == 0 && batteryService != NULL) {
        batteryService->noteStopVideo(AID_MEDIA);
    }
@@ -202,8 +198,9 @@ void MediaCodec::BatteryNotifier::noteStopAudio() {
        return;
    }

    mAudioRefCount--;
    sp<IBatteryStats> batteryService = getBatteryService_l();

    mAudioRefCount--;
    if (mAudioRefCount == 0 && batteryService != NULL) {
        batteryService->noteStopAudio(AID_MEDIA);
    }