美文网首页
webrtc网络(network)的处理,cost, prefe

webrtc网络(network)的处理,cost, prefe

作者: 古则 | 来源:发表于2017-05-24 17:23 被阅读130次

    1、网络类的结构

    2、调用逻辑

    //初始化
    PeerConnectionFactory::Initialize  //PeerConnectionFactory.cc 158L
    default_network_manager_.reset(new rtc::BasicNetworkManager());
    
    //赋值给BasicPortAllocator
    PeerConnectionFactory::CreatePeerConnection //PeerConnectionFactory.cc 282L
    allocator.reset(new cricket::BasicPortAllocator(default_network_manager_.get(), default_socket_factory_.get()));
    
    //调用
    BasicPortAllocatorSession::BasicPortAllocatorSession //BasicPortAllocator.cc 155L
    allocator_->network_manager()->SignalNetworksChanged.connect( this, &BasicPortAllocatorSession::OnNetworksChanged);
    //生成network的vector
    allocator_->network_manager()->StartUpdating(); 
    
    //每个network生成一个port
    BasicPortAllocatorSession::DoAllocate  //BasicPortAllocator.cc 341L
    
    AllocationSequence* sequence = new AllocationSequence(this, networks[i], config, sequence_flags);
    if (!sequence->Init()) {
            delete sequence;
            continue;
    }
    done_signal_needed = true;
    sequence->SignalPortAllocationComplete.connect(this, &BasicPortAllocatorSession::OnPortAllocationComplete);
    if (running_)
            sequence->Start(); //开始创建各个port,继而将network传给port
    

    可以看出每个network下面建了一套port

    3、network的收集过程

    相关文章

      网友评论

          本文标题:webrtc网络(network)的处理,cost, prefe

          本文链接:https://www.haomeiwen.com/subject/sieoxxtx.html