Comments (3)
Hello @disa6302 ,
After rigorous live testing with different users on different networks, the problem was isolated to the following:
func checkAndAddIceCandidate(remoteCandidate: RTCIceCandidate, clientId: String) {
**if(clientId == ""){return}**
// if answer/offer is not received, it means peer connection is not found. Hold the received ICE candidates in the map.
if peerConnectionFoundMap.index(forKey: clientId) == nil {
print("SDP exchange not completed yet. Adding candidate: \(remoteCandidate.sdp) to pending queue")
// If the entry for the client ID already exists (in case of subsequent ICE candidates), update the queue
if pendingIceCandidatesMap.index(forKey: clientId) != nil {
var pendingIceCandidateListByClientId: Set<RTCIceCandidate> = pendingIceCandidatesMap[clientId]!
pendingIceCandidateListByClientId.insert(remoteCandidate)
pendingIceCandidatesMap[clientId] = pendingIceCandidateListByClientId
}
// If the first ICE candidate before peer connection is received, add entry to map and ICE candidate to a queue
else {
var pendingIceCandidateListByClientId = Set<RTCIceCandidate>()
pendingIceCandidateListByClientId.insert(remoteCandidate)
pendingIceCandidatesMap[clientId] = pendingIceCandidateListByClientId
}
}
// This is the case where peer connection is established and ICE candidates are received for the established connection
else {
print("Peer connection found already")
// Remote sent us ICE candidates, add to local peer connection
let peerConnectionCurrent : RTCPeerConnection = peerConnectionFoundMap[clientId]!
peerConnectionCurrent.add(remoteCandidate);
print("Added ice candidate \(remoteCandidate.sdp)");
}
}
This method was added in the last merge in order to handle out of turn ICE candidates as per the PR request. It uses a dictionary with the client Id as key to maintain the pending Ice Candidates by Client Id. We had noticed that sometimes, the app crashed with a EXC_BAD_ACCESS crash at:
pendingIceCandidateListByClientId.insert(remoteCandidate)
Our engineers, added some debug and prematurely concluded that this maybe when client id is received as empty(""). As error handling, the following statement was added which was causing the WebRTC to fail on many but certain network combinations. On certain networks like Airtel 4G, it worked 100% of the time.
if(clientId == ""){return}
Removing this statement, made it to work again on all networks with consistency. Hence, could you help us with the following:
- pendingIceCandidatesMap is a dictionary with clientId as the key. It seems a bit odd that the clientId is received empty almost all the time. Is it expected and natural?
- We suspect the Exec_Bad_Access could be happening sometimes due to some race condition considering the nature of these messages. Could you think of any reasons why this may be happening and suggest possible resolution.
Thank you in advance!
from amazon-kinesis-video-streams-webrtc-sdk-ios.
@bijuC1983
ConnectAsViewer requries clientId
https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-websocket-apis-1.html
but the ConnectAsMaster does not require one (1 to many)
https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-websocket-apis-2.html
In your scenario, the camera is connecting as master and mobile device is associating the iceCandidates from the master with that empty key clientId.
Hope this helps!
Thanks,.
from amazon-kinesis-video-streams-webrtc-sdk-ios.
@bijuC1983 ,
Given
Removing this statement, made it to work again on all networks with consistency.
closing the issue for now. Please re-open or create a new one as needed.
from amazon-kinesis-video-streams-webrtc-sdk-ios.
Related Issues (20)
- Is it possible to remove Cognito from AWS Kinesis Video Streams WebRTC iOS SDK HOT 4
- Intermittent issue in getting AWSCredentials and iceserverlist. Error [Unexpected nil while unwrapping optional value] HOT 1
- Can this iOS SDK work with WebRTC Test Page? HOT 1
- Error running demo on MAC (mac book m1 pro). HOT 2
- the Cognito authentication for this sdk HOT 2
- About supporting higher versions of xcode
- Apply Custom Shaders
- AWSMobileClient Sign In Error HOT 2
- failed with error 0 : [0x00000041] No route to host HOT 1
- There is memory leak. where can I fix it? HOT 1
- Speaker issue HOT 2
- Get exception"identityId shouldn't be nil" when integrated with China beijing region cognito identity pool HOT 2
- How to implement multi-user video calling HOT 3
- Sound not coming from main speaker(loud speaker) on iPhone for webrtc livestream HOT 1
- Outgoing audio not working
- ResourceNotFoundException HOT 2
- Not working this object (AWSKinesisVideoCreateSignalingChannelInput()) HOT 12
- Microphone permission is getting asked from sdk after successful peer connection. How to stop that? HOT 1
- Why webrtc ios example contain authentication? HOT 1
- What are the changes we need to do in webrtc iOS example for allow guest users?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-kinesis-video-streams-webrtc-sdk-ios.