2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
오디오
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android의 오디오 하드웨어 추상화 계층(HAL)은 android.media에 있는 상위 수준의 오디오별 프레임워크 API를 기본 오디오 드라이버 및 하드웨어에 연결합니다. 이 섹션에는 구현 안내와 성능 향상에 관한 팁이 포함되어 있습니다.
Android 오디오 아키텍처는 오디오 기능이 구현되는 방식을 정의하고 구현에 관여하는 관련성이 높은 소스 코드를 나타냅니다.
그림 1. Android 오디오 아키텍처
-
애플리케이션 프레임워크
-
애플리케이션 프레임워크에는 android.media API를 사용하여 오디오 하드웨어와 상호작용하는 앱 코드가 포함되어 있습니다. 내부적으로 이 코드는 상응하는 JNI glue 클래스를 호출하여 오디오 하드웨어와 상호작용하는 네이티브 코드에 액세스합니다.
-
JNI
-
android.media와 연결된 JNI 코드는 하위 수준의 네이티브 코드를 호출하여 오디오 하드웨어에 액세스합니다. JNI는
frameworks/base/core/jni/
및 frameworks/base/media/jni
에 있습니다.
-
네이티브 프레임워크
-
네이티브 프레임워크는 android.media 패키지와 동일한 네이티브를 제공하며, 이를 통해 바인더 IPC 프록시를 호출하여 미디어 서버의 오디오별 서비스에 액세스합니다.
네이티브 프레임워크 코드는
frameworks/av/media/libmedia
에 있습니다.
-
바인더 IPC
-
바인더 IPC 프록시는 프로세스 경계를 통한 통신을 용이하게 합니다. 프록시는
frameworks/av/media/libmedia
에 있으며 문자 'I'로 시작합니다.
-
미디어 서버
-
미디어 서버에는 HAL 구현과 상호작용하는 실제 코드인 오디오 서비스가 포함되어 있습니다. 미디어 서버는
frameworks/av/services/audioflinger
에 있습니다.
-
하드웨어 추상화 계층(HAL)
-
HAL이 정의하는 표준 인터페이스는 오디오 서비스에서 호출되며 오디오 하드웨어가 제대로 기능하도록 구현되어야 합니다. 자세한 내용은 오디오 HAL 인터페이스와 상응하는 HAL 버전 디렉터리의
*.hal
파일에 있는 주석을 참고하세요.
-
커널 드라이버
-
오디오 드라이버는 하드웨어 및 HAL 구현과 상호작용합니다. ALSA(Advanced Linux Sound Architecture), OSS(Open Sound System) 또는 맞춤 드라이버를 사용할 수 있습니다(HAL은 드라이버에 구속받지 않음).
참고: ALSA를 사용하는 경우 드라이버의 사용자 부분에 호환 가능한 라이선스가 있는 external/tinyalsa
를 권장합니다(일반 사용자 모드 라이브러리는 GPL 라이선스임).
-
OpenSL ES 기반의 Android 네이티브 오디오(표시되지 않음)
-
이 API는 Android NDK의 일부로 노출되며 android.media와 아키텍처 수준이 동일합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Audio\n\nAndroid's audio Hardware Abstraction Layer (HAL) connects the higher-level,\naudio-specific framework APIs in [android.media](http://developer.android.com/reference/android/media/package-summary.html) to the underlying audio driver and\nhardware. This section includes implementation instructions and tips for\nimproving performance.\n\n\nAndroid audio architecture defines how audio functionality is implemented and\npoints to the relevant source code involved in the implementation.\n\n\n**Figure 1.** Android audio architecture\n\n\nApplication framework\n:\n The application framework includes the app code, which uses the [android.media](http://developer.android.com/reference/android/media/package-summary.html) APIs to\n interact with audio hardware. Internally, this code calls corresponding JNI glue\n classes to access the native code that interacts with audio hardware.\n\n\nJNI\n:\n The JNI code associated with [android.media](http://developer.android.com/reference/android/media/package-summary.html) calls lower level native code to access audio\n hardware. JNI is located in `frameworks/base/core/jni/` and\n `frameworks/base/media/jni`.\n\n\nNative framework\n:\n The native framework provides a native equivalent to the [android.media](http://developer.android.com/reference/android/media/package-summary.html) package, calling\n Binder IPC proxies to access the audio-specific services of the media server.\n Native framework code is located in `frameworks/av/media/libmedia`.\n\n\nBinder IPC\n:\n Binder IPC proxies facilitate communication over process boundaries. Proxies are\n located in `frameworks/av/media/libmedia` and begin with the letter\n \"I\".\n\n\nMedia server\n:\n The media server contains audio services, which are the actual code that\n interacts with your HAL implementations. The media server is located in\n `frameworks/av/services/audioflinger`.\n\n\nHAL\n:\n The HAL defines the standard interface that audio services call into and that\n you must implement for your audio hardware to function correctly. For more details, refer to the [audio HAL\n interface](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/audio/) and comments in the `*.hal` files of the corresponding HAL version directory.\n\n\nKernel driver\n\n: The audio driver interacts with your hardware and HAL implementation. You can use Advanced Linux Sound Architecture (ALSA), Open Sound System (OSS), or a custom driver (HAL is driver-agnostic). **Note** : If you use ALSA, we recommend\n `external/tinyalsa` for the user portion of the driver because of its\n compatible licensing (the standard user-mode library is GPL-licensed).\n\n\nAndroid native audio based on Open SL ES *(not shown)*\n:\n This API is exposed as part of\n [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html)\n and is at the same architecture level as\n [android.media](http://developer.android.com/reference/android/media/package-summary.html)."]]