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

Commit bc56f933 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "libmedia: Creating new sessionId when a dead IAudioTrack object is...

Merge "libmedia: Creating new sessionId when a dead IAudioTrack object is detected" into gingerbread
parents e3a0eecd 4b124770
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ void AudioTrack::start()
        }

        if (mCblk->flags & CBLK_INVALID_MSK) {
            LOGW("start() track %p invalidated, creating a new one", this);
            LOGE("start() track %p invalidated, creating a new one", this);
            // no need to clear the invalid flag as this cblk will not be used anymore
            // force new track creation
            status = DEAD_OBJECT;
@@ -364,7 +364,8 @@ void AudioTrack::start()
            status = mAudioTrack->start();
        }
        if (status == DEAD_OBJECT) {
            LOGV("start() dead IAudioTrack: creating a new one");
            LOGE("start() dead IAudioTrack: creating a new one");
            mSessionId = 0;
            status = createTrack(mStreamType, mCblk->sampleRate, mFormat, mChannelCount,
                                 mFrameCount, mFlags, mSharedBuffer, getOutput(), false);
            if (status == NO_ERROR) {
@@ -848,8 +849,9 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
                        cblk->lock.unlock();
                        result = mAudioTrack->start();
                        if (result == DEAD_OBJECT) {
                            LOGW("obtainBuffer() dead IAudioTrack: creating a new one");
                            LOGE("obtainBuffer() dead IAudioTrack: creating a new one");
create_new_track:
                            mSessionId = 0;
                            result = createTrack(mStreamType, cblk->sampleRate, mFormat, mChannelCount,
                                                 mFrameCount, mFlags, mSharedBuffer, getOutput(), false);
                            if (result == NO_ERROR) {
+2 −3
Original line number Diff line number Diff line
@@ -623,9 +623,8 @@ void MediaPlayer::notify(int msg, int ext1, int ext2)
        // ext1: Media framework error code.
        // ext2: Implementation dependant error code.
        LOGE("error (%d, %d)", ext1, ext2);
        if ( ext1 == MEDIA_ERROR_SERVER_DIED &&
                        mCurrentState == MEDIA_PLAYER_IDLE ) {
            LOGE("Mediaserver died in idle state");
        if ( ext1 == MEDIA_ERROR_SERVER_DIED ) {
            LOGE("Mediaserver died in %d state",mCurrentState);
            mAudioSessionId = AudioSystem::newAudioSessionId();
        }
        mCurrentState = MEDIA_PLAYER_STATE_ERROR;