Android截屏--桌面同时按住power与音量-截图-截图无声音

时间:2022-05-31 15:24:48

问题描述:

【测试步骤】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;