1. 程式人生 > >Android截圖--桌面同時按住power與音量-截圖-截圖無聲音

Android截圖--桌面同時按住power與音量-截圖-截圖無聲音

問題描述:

【測試步驟】1、桌面同時按住power與音量-截圖
【測試結果】截圖無聲音
【預期結果】不應該無聲音

這是一個google common問題,問題原因如下:
decode does not complete when first capture.
solution: for audio sound pool case, skip EOS delay time to faster to send out EOS. 

修改位置:frameworks/av/media/libstagefright/AwesomePlayer.cpp

void AwesomePlayer::postCheckAudioStatusEvent(int64_t delayUs) {
    Mutex::Autolock autoLock(mAudioLock);
    if (mAudioStatusEventPending) {
        return;
    }
    mAudioStatusEventPending = true;
    // Do not honor delay when looping in order to limit audio gap
    if (mFlags & (LOOPING | AUTO_LOOPING)) {
        delayUs = 0;
    }
#ifdef MTK_AOSP_ENHANCEMENT
    // AudioCache needn't delay post EOS, just AudioOutput which with a valid UID needed
    if(!mUIDValid){
        ALOGI("AudioCache needn't delay post EOS!!!");
        //<2015.05.07> modify for start
        delayUs = 0;
        //<2015.05.07> modify for end
    }
#endif
    mQueue.postEventWithDelay(mCheckAudioStatusEvent, delayUs);
}
把delayUs = 3000;改為delayUs = 0;