自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
音訊延遲時間測量
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
延遲時間是重要的系統效能指標。雖然有許多種音訊延遲指標,但往返延遲是一種實用且易於理解的指標,定義為音訊訊號進入行動裝置輸入端、由在應用程式處理器上執行的應用程式處理,以及離開輸出端所需的時間。
圖 1. 裝置上的往返音訊延遲時間:Toutput - Tinput
本頁面提供特定 Nexus/Pixel 裝置和 Android 平台版本的往返音訊延遲時間測量值。
為何測量延遲時間
Google 會評估並回報延遲時間,讓 Android 應用程式開發人員取得所需資料,針對實際裝置的可用延遲時間做出明智決策。我們希望透過分享特定 Nexus 和 Pixel 裝置的延遲數字,鼓勵整個 Android 社群評估、發布並減少所有 Android 裝置的延遲時間。請加入我們的行列,共同致力於縮短音訊延遲時間!
應用程式對延遲時間的影響
訊號處理功能可能會造成下列延遲:
- 演算法。這項延遲是固有的,不會因 CPU 而異動。例如,有限脈衝響應 (FIR) 濾波器會加入延遲時間。
- 運算。這項延遲時間與所需的 CPU 週期數量相關。舉例來說,訊號衰減通常會透過乘法運算完成,而這項運算會根據 CPU 而採用不同數量的週期。
評估方式
我們使用 Rick O'Rang 博士的音訊迴路轉接器和音訊回饋 (Larsen 效果) 測試,進行本頁所列的測量。測量結果假設應用程式信號處理作業不會增加任何演算法延遲時間,且運算延遲時間幾乎為零。
我們透過耳機連接器測量來回延遲時間,原因如下:
圖 2. 透過耳機連接器的往返延遲時間:Toutput - Tinput
- 重要的音樂應用程式 (例如吉他和語音處理) 會使用耳機連接器。
- 測量裝置端麥克風和喇叭的來回延遲可能會很麻煩,因為在開放空間中很難讓回授迴圈不受控地產生振盪。
- 裝置端轉換器體積較小,為了縮小體積,犧牲了頻率響應。為彌補這項缺點,系統會套用數位訊號處理,但會增加裝置端路徑的演算法延遲時間。
在某些情況下,裝置端麥克風和喇叭的延遲確實會影響通話品質,但通常只會影響單向通話,而非雙向通話。如要瞭解如何測量單向延遲時間,請參閱「測量輸出延遲時間」和「測量輸入延遲時間」相關文章。
測量資料範例
下列測量值適用於特定的版本號碼。裝置會依據初始版本和平台版本的順序列出;您也可以在圖表中查看延遲時間。測試應用程式使用以 OpenSL ES 為基礎的 Android 原生音訊 API。
型號 |
平台 版本 |
版本 號碼 |
取樣率 (Hz) |
緩衝區大小 (影格) |
緩衝區大小 (毫秒) |
往返 延遲時間 (ms) ± 一個緩衝區 |
Nexus One |
2.3.6 |
GRK39F |
44100 |
768 |
17.4 |
345 |
Nexus S |
2.3.6 |
GRK39F |
44100 |
1024 |
23.2 |
260 |
Nexus S |
4.0.4 |
IMM76D |
44100 |
1024 |
23.2 |
260 |
Nexus S |
4.1.2 |
JZO54K |
44100 |
880 |
20 |
210 |
Galaxy Nexus |
4.0.1 |
ITL41D |
44100 |
976 |
22.1 |
270 |
Galaxy Nexus |
4.3 |
JWR66Y |
44100 |
144 |
3.3 |
130 |
Nexus 4 |
4.2.2 |
JDQ39E |
48000 |
240 |
5 |
195 |
Nexus 4 |
5.1 |
LMY47O |
48000 |
240 |
5 |
58 |
Nexus 10 |
5.0.2 |
LRX22G |
44100 |
256 |
5.8 |
36 |
Nexus 10 |
5.1 |
LMY47D |
44100 |
256 |
5.8 |
35 |
Nexus 7 2013 |
4.3 |
JSR78D |
48000 |
240 |
5 |
149 |
Nexus 7 2013 |
4.4 |
KRT16S |
48000 |
240 |
5 |
85 |
Nexus 7 2013 |
5.0.2 |
LRX22G |
48000 |
240 |
5 |
64 |
Nexus 7 2013 |
5.1 |
LMY47O |
48000 |
240 |
5 |
55 |
Nexus 7 2013 |
6.0 |
MRA58K |
48000 |
240 |
5 |
55 |
Nexus 5 |
4.4.4 |
KTU84P |
48000 |
240 |
5 |
95 |
Nexus 5 |
5.0.0 |
LRX21O |
48000 |
240 |
5 |
47 |
Nexus 5 |
5.1 |
LMY47I |
48000 |
240 |
5 |
42 |
Nexus 5 |
6.0 |
MRA58K |
48000 |
192 |
4 |
38 |
Nexus 9 |
5.0.0 |
LRX21L |
48000 |
256 |
5.3 |
35 |
Nexus 9 |
5.0.1 |
LRX22C |
48000 |
256 |
5.3 |
38 |
Nexus 9 |
5.1.1 |
LMY47X |
48000 |
256 |
5.3 |
32 |
Nexus 9 |
6.0 |
MRA58K |
48000 |
128 |
2.6 次 |
15 |
Nexus 6 |
5.0.1 |
LRX22C |
48000 |
240 |
5 |
65 |
Nexus 6 |
5.1 |
LMY47I |
48000 |
240 |
5 |
42 |
Nexus 6 |
6.0 |
MRA58K |
48000 |
192 |
4 |
33 |
Nexus 5X |
6.0 |
MDA89E |
48000 |
192 |
4 |
18 |
Nexus 5X |
8.0.0 |
OPR4.170623.020 |
48000 |
192 |
4 |
18 |
Nexus 5X |
8.1.0 |
OPM2.171019.029.C1 |
48000 |
192 |
4 |
18 |
Nexus 6P |
6.0 |
MDA89D |
48000 |
192 |
4 |
18 |
Nexus 6P |
8.0.0 |
OPR5.170623.014 |
48000 |
192 |
4 |
18 |
Nexus 6P |
8.1.0 |
OPM5.171019.019 |
48000 |
192 |
4 |
18 |
Pixel |
7.1.2 |
NHG47L |
48000 |
192 |
4 |
18 |
Pixel |
8.0.0 |
OPR3.170623.013 |
48000 |
192 |
4 |
18 |
Pixel |
8.1.0 |
OPM1.171019.021 |
48000 |
192 |
4 |
18 |
Pixel XL |
7.1.2 |
NHG47L |
48000 |
192 |
4 |
18 |
Pixel XL |
8.0.0 |
OPR3.170623.013 |
48000 |
192 |
4 |
18 |
圖 3. 往返延遲時間
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-03-26 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Audio latency measurements\n\n[Latency](http://en.wikipedia.org/wiki/Latency_%28engineering%29)\nis an important system performance metric. While many kinds of\n[audio latency](/docs/core/audio/latency/latency) metrics exist, one useful and\nwell-understood metric is\n[round-trip latency](/docs/core/audio/latency/measure#measuringRoundTrip),\ndefined as the time it takes for an audio signal to enter the input of a mobile\ndevice, be processed by an app running on the application processor, and exit\nthe output.\n\n**Figure 1.** Round-trip audio latency on\ndevice: T~output~ - T~input~\n\nThis page provides round-trip audio latency measurements for select\nNexus/Pixel devices and Android platform versions.\n\nWhy we measure latency\n----------------------\n\nGoogle measures and reports latency so Android application developers have\nthe data they need to make informed decisions about available latency on actual\ndevices. By sharing latency numbers for select Nexus and Pixel devices, we hope\nto encourage the entire Android community to measure, publish, and reduce\nlatency on *all* Android devices. Please join us in our commitment to\nreducing audio latency!\n\nApp impact on latency\n---------------------\n\nSignal processing can add the following types of delay to latency:\n\n- **Algorithmic** . This delay is inherent and does not vary with the CPU. An example is the delay added by a [finite impulse\n response](http://en.wikipedia.org/wiki/Finite_impulse_response) (FIR) filter.\n- **Computational**. This delay is related to the number of required CPU cycles. For example, attenuation of a signal is usually done by a multiplication operation that takes a varying number of cycles depending on the CPU.\n\nHow we measure\n--------------\n\nWe made the measurements listed on this page using the\n[Dr. Rick O'Rang audio loopback dongle](/docs/core/audio/latency/loopback) and an\n[audio feedback (Larsen effect)\ntest](/docs/core/audio/latency/measure#larsenTest). Measurements assume the application signal processing adds zero\nalgorithmic delay and near-zero computational delay.\n\nWe measure round-trip latency via the headset connector for several reasons:\n\n**Figure 2.** Round-trip latency via headset\nconnector: T~output~ - T~input~\n\n- Important music applications (such as guitar and voice processing) use the headset connector.\n- Measuring round-trip latency of the on-device microphone and speaker can be cumbersome, as it is difficult to keep a feedback loop in open air from entering uncontrolled oscillation.\n- On-device transducers are small and sacrifice frequency response to achieve their small size. To compensate, digital signal processing is applied but increases algorithmic delay for the on-device path.\n\nThere are cases where on-device microphone and speaker latencies *do*\nmatter, but they are usually for one direction, not round-trip. Techniques for\nmeasuring unidirectional latency are described at\n[Measuring Output Latency](/docs/core/audio/latency/measure#measuringOutput)\nand\n[Measuring Input Latency](/docs/core/audio/latency/measure#measuringInput).\n\nExample measurements\n--------------------\n\nThe measurements listed below are specific to a\n[build number](/docs/setup/build-numbers). Devices are listed in\napproximate order of initial release and by platform version; you can also\n[view latencies in a chart](#chart). The test application uses the\nAndroid native audio API based on OpenSL ES.\n\n| Model | Platform version | Build number | Sample rate (Hz) | Buffer size (frames) | Buffer size (ms) | Round-trip latency (ms) ± one buffer |\n|--------------|------------------|--------------------|------------------|----------------------|------------------|--------------------------------------|\n| Nexus One | 2.3.6 | GRK39F | 44100 | 768 | 17.4 | 345 |\n| Nexus S | 2.3.6 | GRK39F | 44100 | 1024 | 23.2 | 260 |\n| Nexus S | 4.0.4 | IMM76D | 44100 | 1024 | 23.2 | 260 |\n| Nexus S | 4.1.2 | JZO54K | 44100 | 880 | 20 | 210 |\n| Galaxy Nexus | 4.0.1 | ITL41D | 44100 | 976 | 22.1 | 270 |\n| Galaxy Nexus | 4.3 | JWR66Y | 44100 | 144 | 3.3 | 130 |\n| Nexus 4 | 4.2.2 | JDQ39E | 48000 | 240 | 5 | 195 |\n| Nexus 4 | 5.1 | LMY47O | 48000 | 240 | 5 | 58 |\n| Nexus 10 | 5.0.2 | LRX22G | 44100 | 256 | 5.8 | 36 |\n| Nexus 10 | 5.1 | LMY47D | 44100 | 256 | 5.8 | 35 |\n| Nexus 7 2013 | 4.3 | JSR78D | 48000 | 240 | 5 | 149 |\n| Nexus 7 2013 | 4.4 | KRT16S | 48000 | 240 | 5 | 85 |\n| Nexus 7 2013 | 5.0.2 | LRX22G | 48000 | 240 | 5 | 64 |\n| Nexus 7 2013 | 5.1 | LMY47O | 48000 | 240 | 5 | 55 |\n| Nexus 7 2013 | 6.0 | MRA58K | 48000 | 240 | 5 | 55 |\n| Nexus 5 | 4.4.4 | KTU84P | 48000 | 240 | 5 | 95 |\n| Nexus 5 | 5.0.0 | LRX21O | 48000 | 240 | 5 | 47 |\n| Nexus 5 | 5.1 | LMY47I | 48000 | 240 | 5 | 42 |\n| Nexus 5 | 6.0 | MRA58K | 48000 | 192 | 4 | 38 |\n| Nexus 9 | 5.0.0 | LRX21L | 48000 | 256 | 5.3 | 35 |\n| Nexus 9 | 5.0.1 | LRX22C | 48000 | 256 | 5.3 | 38 |\n| Nexus 9 | 5.1.1 | LMY47X | 48000 | 256 | 5.3 | 32 |\n| Nexus 9 | 6.0 | MRA58K | 48000 | 128 | 2.6 | 15 |\n| Nexus 6 | 5.0.1 | LRX22C | 48000 | 240 | 5 | 65 |\n| Nexus 6 | 5.1 | LMY47I | 48000 | 240 | 5 | 42 |\n| Nexus 6 | 6.0 | MRA58K | 48000 | 192 | 4 | 33 |\n| Nexus 5X | 6.0 | MDA89E | 48000 | 192 | 4 | 18 |\n| Nexus 5X | 8.0.0 | OPR4.170623.020 | 48000 | 192 | 4 | 18 |\n| Nexus 5X | 8.1.0 | OPM2.171019.029.C1 | 48000 | 192 | 4 | 18 |\n| Nexus 6P | 6.0 | MDA89D | 48000 | 192 | 4 | 18 |\n| Nexus 6P | 8.0.0 | OPR5.170623.014 | 48000 | 192 | 4 | 18 |\n| Nexus 6P | 8.1.0 | OPM5.171019.019 | 48000 | 192 | 4 | 18 |\n| Pixel | 7.1.2 | NHG47L | 48000 | 192 | 4 | 18 |\n| Pixel | 8.0.0 | OPR3.170623.013 | 48000 | 192 | 4 | 18 |\n| Pixel | 8.1.0 | OPM1.171019.021 | 48000 | 192 | 4 | 18 |\n| Pixel XL | 7.1.2 | NHG47L | 48000 | 192 | 4 | 18 |\n| Pixel XL | 8.0.0 | OPR3.170623.013 | 48000 | 192 | 4 | 18 |\n\n**Figure 3.** Round trip latencies"]]