When making a voip call with BT ,the sound of maker would berecorded into the phone and send to the receiver, at the same time,the sound of receiver would come from the BT.
That is to say, we could divide the whole progress intorecording and tracking.
Recording and tracking are the progress of opposite, thefollowing sequence diagram is tracking, to see audio record sequencediagram, we only need to change output to Input ,AudioTrack to AudioRecord and TrackHandler toRecordHandler.
The number descript as belw,
1,after request audio focus, it can record or track,
6,7,8,at these steps, it can check routing, device etc.,like checking and setting BT or earpiece is used, the callstate and the callis a voip call or a real call,
10, openOutput to AudioFlinger would cause AudioFlingerto create work thread like MixerThread,
11,open output stream, in_read or out_write inaudio_hw.c,
12,get mixer thread for audio track, actually, I thinkthe record thread don’t need this step,
13,add the next audio thread into playback thread,
14,return the next audio track thread id with deviceinfo,
15,according to the receiving thread id, AudioTrack wouldcall method creatTrack(),and AudioFlinger would create the track in the giventhread id,
16,there are two more steps before this, PlaybackThread*thread = checkPlaybackThread_I (output), mClients.add(pid,client),AudioTrackand AudioRecord progress are AudioFlinger’s client, and all client progress ismarked by progress pid,
17,18, AudioHandle is server side of the client'sIAudioTrack, at the same time, RecordHande is to IAudioRecord, TrackHandlerextends BnAudioTrack and RecordHandle extends BnAudioRecord they are based onBinder communication,
19,AudioTrack would send the audio data to the upperthread,and the thread finally write data into shared memory.
another picture of audio track sequence
本文详细解析了通过BT设备进行VoIP通话时的音频处理流程,包括录音和跟踪两个主要阶段。文中通过一系列步骤展示了如何建立音频连接,并重点介绍了在不同阶段涉及的设备检查与设置操作。
1万+

被折叠的 条评论
为什么被折叠?



