wifi断开时如何重新连接webrtc的udp套接字?udp错误:101

时间:2020-05-20 02:32:34

标签: webrtc

断开wifi并更改为4g后,webrtc套接字不起作用。 在以下代码处引发错误: 有没有一种方法可以重新连接套接字并避免udp套接字的发送错误?

  int UDPPort::SendTo(const void* data,
                        size_t size,
                        const rtc::SocketAddress& addr,
                        const rtc::PacketOptions& options,
                        bool payload) {
      rtc::PacketOptions modified_options(options);
      CopyPortInformationToPacketInfo(&modified_options.info_signaled_after_sent);
      int sent = socket_->SendTo(data, size, addr, modified_options);
      if (sent < 0) {
        error_ = socket_->GetError();
        // Rate limiting added for crbug.com/856088.
        // TODO(webrtc:9622): Use general rate limiting mechanism once it exists.
        if (send_error_count_ < kSendErrorLogLimit) {
          ++send_error_count_;
          RTC_LOG(LS_ERROR) << ToString() << ": UDP send of " << size
                            << " bytes failed with error " << error_;
          __android_log_print(ANDROID_LOG_DEBUG,"hjs", "UDP send of [%d] bytes failed with error [%d]\n",size,error_);
        }
      } else {
        send_error_count_ = 0;
      }
      return sent;
    }

0 个答案:

没有答案