Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU load with empty RTCPeerConnection #156

Open
parazzzite1 opened this issue Dec 5, 2024 · 0 comments
Open

High CPU load with empty RTCPeerConnection #156

parazzzite1 opened this issue Dec 5, 2024 · 0 comments

Comments

@parazzzite1
Copy link

parazzzite1 commented Dec 5, 2024

Hi! I have a problem with RTCPeerConnection.

I create two WebRTC clients, estabilish connection between them (offer-answer). Mic capture is in progress, but not data is not trasferred between them (checked peerConnection.stats) - and it seems fine, because i'm actually do not start transfering of any audio/video.

But with such an "empty" peer connection CPU usage is increaased up to 20%. Looks weird. Do you know what could cause such impact?

Sample code is below.

webRtcClientOne = WebRTCClient(peerConnectionFactory: factory)
webRtcClientTwo = WebRTCClient(peerConnectionFactory: factory)

webRtcClientOne.offer { [unowned self] oneSdp in
  webRtcClientTwo.set(remoteSdp: oneSdp) { [unowned self] _ in
    webRtcClientTwo.answer { [unowned self] twoSdp in
      webRtcClientOne.set(remoteSdp: twoSdp) { _ in
      }
    }
  }
}

timer = Timer.scheduledTimer(withTimeInterval: 5, repeats: true, block: { timer in
  self.webRtcClientOne.peerConnection.stats(for: nil, statsOutputLevel: .debug) { stats in
    print(stats)
  }
})

Stats show that no bytes sent, but CPU load is increased significantly (+20% on iPhone 7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant