核心模块:
/system/lib/hw/audio.r_submix.default.so hardware/libhardware/modules/audio_remote_submix
核心关键词 remote submix
我将audio.r_submix.default.so 没有重命名的时候,APK能够正常录制,但重命名之后,再重启设置,APK启动就出错了
W/AudioPolicyManager( 171): getInput() could not find device for inputSource 8
E/AudioRecord( 2439): Could not get audio input for record source 8, sample rate 44100, format 0x1, channel mask 0xc, session 13, flags 0
E/AudioRecord-JNI( 2439): Error creating AudioRecord instance: initialization check failed with status -22.
E/android.media.AudioRecord( 2439): Error code -20 when initializing native AudioRecord object.
D/OpenGLRenderer( 2439): Render dirty regions requested: true
--------- beginning of crash
E/AndroidRuntime( 2439): FATAL EXCEPTION: Thread-284
E/AndroidRuntime( 2439): Process: com.hp.androidremotesubmix, PID: 2439
E/AndroidRuntime( 2439): java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
E/AndroidRuntime( 2439): at android.media.AudioRecord.startRecording(AudioRecord.java:603)
E/AndroidRuntime( 2439): at com.hp.androidremotesubmix.MainActivity.recordAndPlay(MainActivity.java:49)
E/AndroidRuntime( 2439): at com.hp.androidremotesubmix.MainActivity.access$0(MainActivity.java:47)
E/AndroidRuntime( 2439): at com.hp.androidremotesubmix.MainActivity$1.run(MainActivity.java:28)
正常的log
I/ActivityManager( 462): Start proc com.hp.androidremotesubmix for activity com.hp.androidremotesubmix/.MainActivity: pid=3731 uid=10127 gids={50127, 9997, 1028, 1015, 1023} abi=armeabi-v7a
D/r_submix( 170): adev_open_input_stream()
D/r_submix( 170): submix_audio_device_create_pipe()
I/AudioFlinger( 170): AudioFlinger's thread 0xb4a98008 ready to run
I/r_submix( 170): in_standby()
I/r_submix( 170): in_standby()
D/r_submix( 170): adev_open_output_stream()
D/r_submix( 170): submix_audio_device_create_pipe()
I/AudioFlinger( 170): HAL output buffer size 2048 frames, normal sink buffer size 2048 frames
I/AudioFlinger( 170): AudioFlinger's thread 0xb1841008 ready to run
I/r_submix( 170): out_standby()
I/AudioFlinger( 170): HAL output buffer size 2048 frames, normal sink buffer size 2048 frames
I/AudioFlinger( 170): AudioFlinger's thread 0xb1702008 ready to run
D/OpenGLRenderer( 3731): Render dirty regions requested: true
D/Atlas ( 3731): Validating map...
W/AudioTrack( 170): dead IAudioTrack, PCM, creating a new one from obtainBuffer()
W/Atlas ( 3731): Pointer 0x0, not in getPreloadedDrawables?
W/Atlas ( 3731): Pointer 0x0, not in getPreloadedDrawables?
W/Atlas ( 3731): Pointer 0x0, not in getPreloadedDrawables?
E/AudioTrack( 170): detected illegal retrograde motion by the server: mServer advanced by –1381094
【关闭,退出】
E/audio_a2dp_hw( 170): adev_set_parameters: ERROR: set param called even when stream out is null
W/AudioTrack( 170): dead IAudioTrack, PCM, creating a new one from obtainBuffer()
W/AudioSystem( 170): ioConfigChanged() closing unknown output! 29
D/r_submix( 170): out_set_parameters(): shutting down MonoPipe sink
I/r_submix( 170): in_standby()
W/AudioSystem( 170): ioConfigChanged() closing unknown output! 28
D/r_submix( 170): out_set_parameters(): shutting down MonoPipe sink
I/r_submix( 170): out_standby()
D/r_submix( 170): adev_close_output_stream()
E/AudioTrack( 170): detected illegal retrograde motion by the server: mServer advanced by -2841216
W/AudioPolicyManager( 170): releaseOutput() releasing unknown output 28
D/r_submix( 170): adev_close_input_stream()
D/r_submix( 170): submix_audio_device_release_pipe()
D/r_submix( 170): submix_audio_device_destroy_pipe(): pipe destroyed
【切换MIC播放】
D/AudioHardware( 170): AudioHardware pcm playback is exiting standby.
D/AudioHardware( 170): openPcmOut_l() mPcmOpenCnt: 0
D/alsa_route( 170): route_info->sound_card 0, route_info->devices 0
D/alsa_pcm( 170): pcm_open(0x0011f000)
D/alsa_pcm( 170): pcm_open() card 0, device 0, Playback
D/alsa_pcm( 170): set audio rate 48KHz
D/alsa_route( 170): route_set_controls() set route 0
W/MediaPlayer( 3602): info/warning (3, 0)
W/MediaPlayer( 3602): info/warning (702, 0)
W/AudioFlinger( 170): write blocked for 411 msecs, 4 delayed writes, thread 0xb58e2008