WebRTCDemo.apk代码走读(一):初始化

  1. MediaEngine.java:MediaEngine初始化
    转载注明出处http://blog.csdn.net/wanghorse
new VoiceEngine/VoiceEngine_create
    new VoiceEngineData
        webrtc::VoiceEngine::Create
            GetVoiceEngine
                new VoiceEngineImpl
                    初始化SharedData
                        ProcessThread::CreateProcessThread
                        OutputMixer::Create
                            new OutputMixer
                                AudioConferenceMixer::Create
                                    new AudioConferenceMixerImpl
                                    AudioConferenceMixerImpl::Init
                        TransmitMixer::Create
                            new TransmitMixer
                    初始化VoEAudioProcessingImpl
                    初始化VoECodecImpl
                    初始化VoEDtmfImpl
                    初始化VoENetEqStatsImpl
                    初始化VoENetworkImpl
                    初始化VoERTP_RTCPImpl
                    初始化VoEVideoSyncImpl
                    初始化VoEVolumeControlImpl
                    初始化VoEBaseImpl
VoiceEngine_init
    VoEBaseImpl::Init
        WebRtcSpl_Init          
        ProcessThreadImpl::Start
        AudioDeviceModuleImpl::Create
            AudioDeviceModuleImpl::CreatePlatformSpecificObjects
                new AudioDeviceTemplate
                new AudioDeviceUtilityAndroid
        SharedData::set_audio_device            
        ProcessThreadImpl::RegisterModule(AudioDeviceModuleImpl)    
        AudioDeviceModuleImpl::RegisterEventObserver
        AudioDeviceModuleImpl::RegisterAudioCallback
        AudioDeviceModuleImpl::init
        AudioDeviceModuleImpl::SetPlayoutDevice
        AudioDeviceModuleImpl::InitSpeaker
        AudioDeviceModuleImpl::SetRecordingDevice
        AudioDeviceModuleImpl::InitMicrophone
        AudioDeviceModuleImpl::StereoPlayoutIsAvailable
        AudioDeviceModuleImpl::SetStereoPlayout
        AudioDeviceModuleImpl::SetStereoRecording
        AudioProcessing::Create
            new AudioProcessingImpl
                new audioproc::Event
                new EchoCancellationImpl
                new EchoControlMobileImpl
                new GainControlImpl
                new HighPassFilterImpl
                new LevelEstimatorImpl
                new NoiseSuppressionImpl
                new VoiceDetectionImpl
                new GainControlForNewAgc
VoiceEngine_createChannel
    VoEBaseImpl::CreateChannel
        ChannelManager::CreateChannel
             ChannelManager::CreateChannelInternal
                Channel::CreateChannel
                    new Channel             
        VoEBaseImpl::InitializeChannel
            Channel::SetEngineInformation                   
new VideoEngine
    video_engine_jni.cc:VideoEngine_create
        new VideoEngineData 
            vie(vie_imple.cc:webrtc::VideoEngine::Create())
                new VideoEngineImpl
                    初始化ViEBaseImpl
                        new ViESharedData
                            初始化number_cores_(CpuInfo::DetectNumberOfCores()
                            channel_manager_(new ViEChannelManager(0, number_cores_, config)),
                                input_manager_(new ViEInputManager(0, config)),
                                render_manager_(new ViERenderManager(0)),
                                module_process_thread_(ProcessThread::CreateProcessThread()),
                                    new ProcessThreadImpl
                                channel_manager_/input_manager_使用module_process_thread_
                                module_process_thread_启动
VideoEngine_init
    ViEBaseImpl::Init
VideoEngine_setVoiceEngine
    ViEBaseImpl::SetVoiceEngine
        ViEChannelManager::SetVoiceEngine   
            ViEChannel::SetVoiceChannel
                ViESyncModule::ConfigureSync
                    new StreamSynchronization
                        new ViESyncDelay
VideoEngine_createChannel       
    VideoEngineData::CreateChannel                      
        ViEBaseImpl::CreateChannel
            ViEChannelManager::CreateChannel
                new ChannelGroup
                    new VieRemb
                    BitrateController::CreateBitrateController
                        BitrateControllerImpl::BitrateControllerImpl
                    new CallStats
                    new EncoderStateFeedback
                    new WrappingBitrateEstimator                            
                    将主要Module注册到ProcessThread
                new ViEEncoder
                    vcm_(*webrtc::VideoCodingModule::Create())
                        new VideoCodingModuleImpl
                            sender_(new vcm::VideoSender(clock, &post_encode_callback_)),
                                new DebugRecorder(媒体写文件)
                            receiver_(new vcm::VideoReceiver(clock, event_factory))
                    vpm_(*webrtc::VideoProcessingModule::Create(channel_id))),
                        new VideoProcessingModuleImpl
                    RtpRtcp::CreateRtpRtcp                                     
                        new ModuleRtpRtcpImpl
                            RTPSender初始化
                                new RTPSenderVideo
                            RTCPSender初始化
                            RTCPReceiver初始化
                            RTCPReceiver::RegisterRtcpObservers
                    new ViEBitrateObserver
                    new ViEPacedSenderCallback
                BitrateControllerImpl::CreateRtcpBandwidthObserver
                ViEEncoder::Init
                    VideoCodingModuleImpl::InitializeSender 
                        VideoSender::InitializeSender
                            VCMCodecDataBase::ResetSender
                    VideoProcessingModuleImpl::EnableTemporalDecimation     
                        VPMFramePreprocessor::EnableTemporalDecimation
                            VPMVideoDecimator::EnableTemporalDecimation
                    VideoProcessingModuleImpl::EnableContentAnalysis        
                        VPMFramePreprocessor::EnableContentAnalysis
                    new QMVideoSettingsCallback
                    VideoCodingModule::Codec
                        VCMCodecDataBase::Codec
                    VideoCodingModuleImpl::RegisterSendCodec
                        VideoSender::RegisterSendCodec
                            VCMCodecDataBase::SetSendCodec
                                CreateEncoder
                                    VP8Encoder::Create
                                        new VP8EncoderImpl
                                    new VCMGenericEncoder
                                VCMGenericEncoder::InitEncode
                                    VP8EncoderImpl::InitEncode
                                VCMGenericEncoder::RegisterEncodeCallback   
                                    VP8EncoderImpl::RegisterEncodeCompleteCallback
                                VCMGenericEncoder::SetPeriodicKeyFrames 
                ViEChannelManager::CreateChannelObject          
                    new ViEChannel
                    ViEChannel::Init
VideoEngine_connectAudioChannel
    ViEBaseImpl::ConnectAudioChannel
        ViEChannelManager::ConnectVoiceChannel
            ViEChannel::SetVoiceChannel
                ProcessThreadImpl::RegisterModule(VoEVideoSync)
                ViESyncModule::ConfigureSync                                        
                    new StreamSynchronization

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。