【Android Audio】Audio: summery of making a call

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.


【Android Audio】Audio: summery of making a call_第1张图片


another picture of audio track sequence

【Android Audio】Audio: summery of making a call_第2张图片

你可能感兴趣的:(【Android Audio】Audio: summery of making a call)