码迷,mamicode.com
首页 > Web开发 > 详细

WebRTCDemo.apk代码走读(三):音频接收流程

时间:2015-04-21 20:48:27      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:webrtc   音频   

收到音频包
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,                                                            

WebRTCDemo.apk代码走读(三):音频接收流程

标签:webrtc   音频   

原文地址:http://blog.csdn.net/wanghorse/article/details/45175047

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!