Android Audio 02 - AudioTrack/AudioFlinger/AudioPolicyService 构架
2013-04-01 11:04
501 查看
Appre-----------> AT=audioTrack
AF=audioFlinger
APS=audioPolicyService
AudioTrack:
Java层的代码:1.getMinBufferSize ---->native_get_min_buff_size
2.new AudioTrack ----->constructor
3.play ------>native_start
4.write ------->native_write_byte
5.stop/release
java层会最终调用native层的代码,所以最后实现还是靠native。
native层:new AudioTrack --> native-setup ---->set()
set里面会做两件事情:1. audioSystem::getOutput
2.audioFlinger->createTrack
AT要创建track,需要和Thread绑定,比如DirectOutput Thread,Mixer Thread,duplicating Thread等。getOutput就是找到这个track需要在哪类Thread上创建。因为这些个track都通过一个thread来混音,然后调用HAL出去播放。
AT的getOutput ----> AudioSystem::getOutput -> APS::getOutput -->APMB::getOutput
APMB::output---->1.getStrategy
2.getDeviceForStrategy
3.find the thread ----->how?Thread 什么时候创建的了????
getoutput是能够找到合适的thread去创建track,但是这个thread是什么时候创建的?又是谁创建的了???
-------------------------
thread的创建
-----------------------
AF和APS都在main_mediaServer.cpp中有初始化instantiate
APS的构造-->APMB constructor -->APS::openOutput -->AF::openOutput --> new Mixer Thread/DirectOutput/add into pool
好了,我们终于创建Thread的了
总结下:AT在native的set()中会通过getOutput找到合适的thread,然后AF会createTrack.
AF::createTrack会用相应的thread去创建track,跟thread绑定,track没法binder,new一个trackhandle
AF=audioFlinger
APS=audioPolicyService
AudioTrack:
Java层的代码:1.getMinBufferSize ---->native_get_min_buff_size
2.new AudioTrack ----->constructor
3.play ------>native_start
4.write ------->native_write_byte
5.stop/release
java层会最终调用native层的代码,所以最后实现还是靠native。
native层:new AudioTrack --> native-setup ---->set()
set里面会做两件事情:1. audioSystem::getOutput
2.audioFlinger->createTrack
AT要创建track,需要和Thread绑定,比如DirectOutput Thread,Mixer Thread,duplicating Thread等。getOutput就是找到这个track需要在哪类Thread上创建。因为这些个track都通过一个thread来混音,然后调用HAL出去播放。
AT的getOutput ----> AudioSystem::getOutput -> APS::getOutput -->APMB::getOutput
APMB::output---->1.getStrategy
2.getDeviceForStrategy
3.find the thread ----->how?Thread 什么时候创建的了????
getoutput是能够找到合适的thread去创建track,但是这个thread是什么时候创建的?又是谁创建的了???
-------------------------
thread的创建
-----------------------
AF和APS都在main_mediaServer.cpp中有初始化instantiate
APS的构造-->APMB constructor -->APS::openOutput -->AF::openOutput --> new Mixer Thread/DirectOutput/add into pool
好了,我们终于创建Thread的了
总结下:AT在native的set()中会通过getOutput找到合适的thread,然后AF会createTrack.
AF::createTrack会用相应的thread去创建track,跟thread绑定,track没法binder,new一个trackhandle
相关文章推荐
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android AudioPolicyService和AudioPolicyManager .
- Android AudioPolicyService和AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- 【Android Audio】Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android AudioPolicyService服务启动过程
- Android Audio Subsystem - get_audio_flinger - 02
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System之三:AudioPolicyService和AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android 7.0 Audio: AudioPolicyService和他的码农APM
- 深入理解Android音频框架AudioTrack到AudioFlinger及Mix过程
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager