2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
오디오 준비
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
오디오 준비는 기기의 오디오 앰프 회로가 완전히 켜져 정상 작동 상태가 되는 데 걸리는 시간입니다. 오디오 준비 시간의 주요 원인은 전원 관리와 회로를 안정화하는 'de-pop' 로직입니다.
이 문서에서는 오디오 준비 시간을 측정하는 방법과 준비 시간을 줄일 수 있는 방법을 설명합니다.
출력 준비 측정
AudioFlinger의 FastMixer 스레드는 자동으로 출력 준비를 측정하여 이를 dumpsys media.audio_flinger
명령어 출력의 일부로 보고합니다.
준비 시 FastMixer는 두 write()
간 시간이 예상치에 도달할 때까지 write()
를 반복 호출합니다.
FastMixer는 HAL(하드웨어 추상화 계층) write()
가 안정화에 필요한 시간을 파악하여 오디오 준비를 결정합니다.
오디오 준비를 측정하려면 부팅 후 서로 다른 시점에 내장 스피커와 유선 헤드폰과 관련하여 다음 단계를 따릅니다. 일반적으로 준비 시간은 출력 기기마다 다르고 기기 부팅 직후에 다릅니다.
- FastMixer가 사용 설정되었는지 확인합니다.
- 기기에서 설정 > 소리 > 터치 소리를 선택하여 터치음을 사용 설정합니다.
- 오디오가 3초 이상 꺼지도록 합니다. AudioFlinger에서는 3초가 소요되지만, 하드웨어에는 3초 이상 소요되는 자체 전원 로직이 있을 수 있기 때문에 5초 이상으로 하는 것이 더 좋습니다.
- 홈을 누르면 클릭 소리가 들립니다.
- 측정된 준비 시간을 수신하려면 다음 명령어를 실행합니다.
adb shell dumpsys media.audio_flinger | grep measuredWarmup
다음과 같이 출력이 표시됩니다.
sampleRate=44100 frameCount=256 measuredWarmup=X ms, warmupCycles=X
measuredWarmup=X
는 첫 HAL write()
집합이 완료되는 데 X밀리초가 소요되는지 알려 줍니다.
warmupCycles=X
는 write()
실행 시간이 예상치와 일치할 때까지 HAL 쓰기 요청이 몇 번 발생했는지 알려 줍니다.
-
측정값 5개를 확인하고 평균값과 함께 기록합니다.
모든 값이 비슷하지 않다면 측정이 잘못되었을 가능성이 큽니다.
예를 들어 오디오가 꺼진 후 충분히 기다리지 않으면 준비 시간이 평균값보다 짧아집니다.
현재 오디오 입력 준비를 측정하는 도구는 제공되지 않습니다.
하지만 startRecording()이 반환되는 데 필요한 시간을 관찰하여 입력 준비 시간을 예측할 수 있습니다.
준비 시간 줄이기
준비 시간은 일반적으로 다음 방법을 함께 사용하여 줄일 수 있습니다.
- 올바른 회로 설계
- 커널 기기 드라이버의 정확한 시간 지연
- 순차적 진행이 아닌 동시에 진행되는 독립된 준비 작업 실행
- 회로 전원을 켜 두거나 클록을 재구성하지 않음(유휴 전력 소비 증가)
- 계산된 매개변수 캐싱
하지만 최적화가 과도하지 않은지 주의해야 합니다. 짧은 준비 시간과 전원 전환 시도 부족의 균형을 맞춰야 할 수도 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-03-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-03-26(UTC)"],[],[],null,["# Audio warmup is the time it takes for the audio amplifier circuit in your device to\nbe fully powered and reach its normal operation state. The major contributors\nto audio warmup time are power management and any \"de-pop\" logic to stabilize\nthe circuit.\n\nThis document describes how to measure audio warmup time and possible ways to decrease\nwarmup time.\n\nMeasure output warmup\n---------------------\n\n\nAudioFlinger's FastMixer thread automatically measures output warmup\nand reports it as part of the output of the `dumpsys media.audio_flinger` command.\nAt warmup, FastMixer calls `write()`\nrepeatedly until the time between two `write()`s is the amount expected.\nFastMixer determines audio warmup by seeing how long a Hardware Abstraction\nLayer (HAL) `write()` takes to stabilize.\n\nTo measure audio warmup, follow these steps for the built-in speaker and wired headphones\nand at different times after booting. Warmup times are usually different for each output device\nand right after booting the device:\n\n1. Ensure that FastMixer is enabled.\n2. Enable touch sounds by selecting **Settings \\\u003e Sound \\\u003e Touch sounds** on the device.\n3. Ensure that audio has been off for at least three seconds. Five seconds or more is better, because the hardware itself might have its own power logic beyond the three seconds that AudioFlinger has.\n4. Press Home, and you should hear a click sound.\n5. Run the following command to receive the measured warmup: \n\n ```\n adb shell dumpsys media.audio_flinger | grep measuredWarmup\n ```\n\n\n You should see output like this: \n\n ```\n sampleRate=44100 frameCount=256 measuredWarmup=X ms, warmupCycles=X\n ```\n\n\n The `measuredWarmup=X` is X number of milliseconds\n it took for the first set of HAL `write()`s to complete.\n\n\n The `warmupCycles=X` is how many HAL write requests it took\n until the execution time of `write()` matches what is expected.\n6. Take five measurements and record them all, as well as the mean. If they are not all approximately the same, then it's likely that a measurement is incorrect. For example, if you don't wait long enough after the audio has been off, you will see a lower warmup time than the mean value.\n\nMeasure input warmup\n--------------------\n\n\nThere are currently no tools provided for measuring audio input warmup.\nHowever, input warmup time can be estimated by observing\nthe time required for [startRecording()](http://developer.android.com/reference/android/media/AudioRecord.html#startRecording())\nto return.\n\nReduce warmup time\n------------------\n\n\nWarmup time can usually be reduced by a combination of:\n\n- Good circuit design\n- Accurate time delays in kernel device driver\n- Performing independent warmup operations concurrently rather than sequentially\n- Leaving circuits powered on or not reconfiguring clocks (increases idle power consumption)\n- Caching computed parameters\n\n\nHowever, beware of excessive optimization. You may find that you\nneed to tradeoff between low warmup time versus\nlack of popping at power transitions."]]