问题
So, we have a WebRTC enabled app that is actually working in the sense that it's establishing sessions, we're able to connect to them, people are publishing streams, other people are subscribing and unsubscribing to those streams, etc. etc. But we keep getting errors from WebRTC which say 'PeerConnection.getStats. Already getting the stats!' The error occurs in the video stream itself. White text on a black background, instead of the video.
Also, in the console log, we're getting the following errors:
Uncaught TypeError: Cannot call method 'getStats' of undefined TB.min.js:208
PeerConnection.getStats: Already getting the stats! TB.min.js:54
Subscriber State Change Failed: 'Failed' cannot transition to 'NotSubscribing' TB.min.js:54
Object
TB.min.js:54
Sending WebSocket message: {"type":1016,"payload":{"streamId":"995827218","fromAddress":"d5e52bf2-03fb-4e3d-885f-297d4d243684","toAddresses":"d5c1a7d8-f70c-44f3-a42c-1c40bab803ca"}} TB.min.js:54
TB.exception :: title: Connection Failed (1013) msg: Subscriber PeerConnection Error: PeerConnection.getStats: Already getting the stats! TB.min.js:54
Subscriber State Change Failed: 'Failed' cannot transition to 'NotSubscribing' TB.min.js:54
Object
TB.min.js:54
Sending WebSocket message: {"type":1016,"payload":{"streamId":"995827218","fromAddress":"d5e52bf2-03fb-4e3d-885f-297d4d243684","toAddresses":"d5c1a7d8-f70c-44f3-a42c-1c40bab803ca"}} TB.min.js:54
TB.exception :: title: Connection Failed (1013) msg: Subscriber PeerConnection Error: PeerConnection.getStats: Already getting the stats! TB.min.js:54
Subscriber State Change Failed: 'Failed' cannot transition to 'NotSubscribing' TB.min.js:54
Object
TB.min.js:54
Sending WebSocket message: {"type":1016,"payload":{"streamId":"995827218","fromAddress":"d5e52bf2-03fb-4e3d-885f-297d4d243684","toAddresses":"d5c1a7d8-f70c-44f3-a42c-1c40bab803ca"}} TB.min.js:54
TB.exception :: title: Connection Failed (1013) msg: Subscriber PeerConnection Error: PeerConnection.getStats: Already getting the stats!
Any ideas on what might be causing this? How do we turn off PeerConnection from polling stats????? Thanks in advance for any suggestions!
回答1:
I haven't seen this before, but if I were to guess this is probably because you were subscribing multiple times to the same stream before it was done subscribing.
来源:https://stackoverflow.com/questions/18702343/how-do-i-resolve-a-webrtc-peerconnection-getstats-error