WebRTC代码走读(三):音频接收流程

专注webrtc、kurento音视频开发
qq:911921258
收到音频包
UdpSocketManagerPosixImpl::Run
    UdpSocketManagerPosixImpl::Process
        UdpSocketPosix::HasIncoming(recvfrom)
            UdpTransportImpl::IncomingRTPCallback
                UdpTransportImpl::IncomingRTPFunction
                    VoiceChannelTransport::IncomingRTPPacket
                        VoENetworkImpl::ReceivedRTPPacket
                            Channel::ReceivedRTPPacket
                                UpdatePlayoutTimestamp
                                    AudioCodingModuleImpl::PlayoutTimestamp
                                        AcmReceiver::GetPlayoutTimestamp
                                            InitialDelayManager::GetPlayoutTimestamp
                                    AudioDeviceModuleImpl::PlayoutDelay
                                        AudioDeviceTemplate::PlayoutDelay
                                            OpenSlesOutput::PlayoutDelay
                                Channel::IsPacketInOrder
                                    ReceiveStatisticsImpl::GetStatistician (这个类应该管理所有的流)
                                    StreamStatisticianImpl::IsPacketInOrder
                                        StreamStatisticianImpl::InOrderPacketInternal (可以学习一下这个判断乱序代码)
                                Channel::IsPacketRetransmitted
                                    StreamStatisticianImpl::IsRetransmitOfOldPacket (可以学习一下这个判断重传代码)
                                ReceiveStatisticsImpl::IncomingPacket       
                                    如果是第一次收到,创建StreamStatisticianImpl                                   
                                    StreamStatisticianImpl::IncomingPacket
                                        StreamStatisticianImpl::UpdateCounters  记录必要的信息, 用于统计,如乱序、重传、jitbuff、计算bitrate
                                        StreamStatisticianImpl::NotifyRtpCallback
                                            ReceiveStatisticsImpl::DataCountersUpdated(没做处理)
                                Channel::ReceivePacket
                                    RtpReceiverImpl::IncomingRtpPacket
                                        check ssrc/play/timestamp
                                        RtpReceiverImpl::CheckSSRCChanged
                                            如果是第一次,则Channel::OnInitializeDecoder
                                                AudioCodingModule::Codec, 选择具体的Codec Inst(数组,一开始已经初始化好所有的)
                                                AudioCodingModuleImpl::RegisterReceiveCodec
                                                    AudioCodingModuleImpl::GetAudioDecoder
                                                        AudioCodingModuleImpl::CreateCodec
                                                            ACMCodecDB::CreateCodecInstance
                                                                new ACMISAC
                                                    AcmReceiver::AddCodec
                                                        NetEq初始化
                                                        NetEqImpl::RegisterExternalDecoder
                                        RTPReceiverAudio::ParseRtpPacket
                                            RTPReceiverAudio::ParseAudioCodecSpecific
                                                判断是不是dtmf、cgn、2833等
                                                Channel::OnReceivedPayloadData
                                                    AudioCodingModuleImpl::IncomingPacket
                                                        AcmReceiver::InsertPacket
                                                            ack
                                                            唇音同步
                                                            NetEqImpl::InsertPacket
                                                                NetEqImpl::InsertPacketInternal
                                                                    ACMISAC::IncomingPacket
                                                        ACMISAC::UpdateDecoderSampFreq
                                                            WebRtcIsac_SetDecSampRate
                                                                DecoderInitUb
                                                    Channel::UpdatePacketDelay
                                                        Channel::GetPlayoutFrequency(
                                                            AudioCodingModuleImpl::PlayoutFrequency()
AudioTrackJni::PlayThreadProcess
    AudioDeviceBuffer::RequestPlayoutData
        VoEBaseImpl::NeedMorePlayData
            VoEBaseImpl::GetPlayoutData
                AudioConferenceMixerImpl::Process
                    AudioConferenceMixerImpl::UpdateToMix
                        所有的与会者Channel::GetAudioFrame
                            AudioCodingModuleImpl::PlayoutData10Ms
                                AcmReceiver::GetAudio
                                    时间判断
                                    可能产生静音包
                                    NetEqImpl::GetAudio
                                        NetEqImpl::GetAudioInternal
                                            NetEqImpl::Decode
                                                ACMISAC::DecodePlc
                                                NetEqImpl::DecodeLoop
                                                    ACMISAC::Decode
                                    NetEqImpl::DecodedRtpInfo
                                    ack的处理
                                    重采样
                            Channel::UpdateRxVadDetection
                                Channel::OnRxVadDetected
                             AudioProcessingImpl::ProcessStream
                                 AudioBuffer::DeinterleaveFrom
                                 AudioBuffer::InterleaveTo
                             必要的音频处理,scale之类的
                        音量判断
                    合成声音                
                OutputMixer::GetMixedAudio  获取合成完的数据
    AudioDeviceBuffer::GetPlayoutData
    复制到java内存
    调用Java程序CallIntMethod(_javaScObj, _javaMidPlayAudio,                                                            
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  •  

你可能感兴趣的:(编程)