question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong arguments order in candidate_from_sdp with Google Nest Cam WebRTC stream

See original GitHub issue

I’m trying to read a WebRTC Stream from Google Nest Cam with the videostream-cli/cli.py example.

I’ve created an SDP offer with the following configuration:

pc.addTransceiver("audio", direction="recvonly")
pc.addTransceiver("video", direction="recvonly")
pc.createDataChannel(label="dataSendChannel")
await pc.setLocalDescription(await pc.createOffer())

And I got this SDP answer from Google: v=0\r\no=- 0 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 2 1\r\na=msid-semantic: WMS 15858084926298797471\/3462220087 virtual-6666\r\na=ice-lite\r\nm=audio 19305 UDP\/TLS\/RTP\/SAVPF 96\r\nc=IN IP4 172.253.117.127\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate: 1 udp 2113939711 2607:f8b0:400e:c0a::7f 19305 typ host generation 0\r\na=candidate: 1 tcp 2113939710 2607:f8b0:400e:c0a::7f 19305 typ host tcptype passive generation 0\r\na=candidate: 1 ssltcp 2113939709 2607:f8b0:400e:c0a::7f 443 typ host generation 0\r\na=candidate: 1 udp 2113932031 172.253.117.127 19305 typ host generation 0\r\na=candidate: 1 tcp 2113932030 172.253.117.127 19305 typ host tcptype passive generation 0\r\na=candidate: 1 ssltcp 2113932029 172.253.117.127 443 typ host generation 0\r\na=ice-ufrag:ICOZDGWXSEYVE\/1H\r\na=ice-pwd:redacted\r\na=fingerprint:sha-256 69:74:37:47:12:20:18:7B:2B:E1:A8:F0:6B:3A:81:08:CF:70:21:D9:35:A9:12:94:67:98:B6:85:C9:BC:D6:2E\r\na=setup:passive\r\na=mid:0\r\na=sendrecv\r\na=msid:virtual-6666 virtual-6666\r\na=rtcp-mux\r\na=rtpmap:96 opus\/48000\/2\r\na=fmtp:96 minptime=10;useinbandfec=1\r\na=ssrc:6666 cname:6666\r\nm=video 9 UDP\/TLS\/RTP\/SAVPF 97 98 101 102\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:ICOZDGWXSEYVE\/1H\r\na=ice-pwd:redacted\r\na=fingerprint:sha-256 69:74:37:47:12:20:18:7B:2B:E1:A8:F0:6B:3A:81:08:CF:70:21:D9:35:A9:12:94:67:98:B6:85:C9:BC:D6:2E\r\na=setup:passive\r\na=mid:1\r\na=extmap:2 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=sendrecv\r\na=msid:15858084926298797471\/3462220087 15858084926298797471\/3462220087\r\na=rtcp-mux\r\na=rtpmap:97 VP8\/90000\r\na=rtcp-fb:97 ccm fir\r\na=rtcp-fb:97 nack\r\na=rtcp-fb:97 nack pli\r\na=rtcp-fb:97 goog-remb\r\na=rtpmap:98 rtx\/90000\r\na=fmtp:98 apt=97\r\na=rtpmap:101 H264\/90000\r\na=rtcp-fb:101 ccm fir\r\na=rtcp-fb:101 nack\r\na=rtcp-fb:101 nack pli\r\na=rtcp-fb:101 goog-remb\r\na=fmtp:101 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:102 rtx\/90000\r\na=fmtp:102 apt=101\r\na=ssrc-group:FID 3462220087 259725458\r\na=ssrc:3462220087 cname:3462220087\r\na=ssrc:259725458 cname:3462220087\r\nm=application 9 DTLS\/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:ICOZDGWXSEYVE\/1H\r\na=ice-pwd:redacted\r\na=fingerprint:sha-256 69:74:37:47:12:20:18:7B:2B:E1:A8:F0:6B:3A:81:08:CF:70:21:D9:35:A9:12:94:67:98:B6:85:C9:BC:D6:2E\r\na=setup:passive\r\na=mid:2\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n

The code crashes in the candidate_from_sdp function, and debugging it I found that in the following code:

    bits = sdp.split()
    assert len(bits) >= 8

    candidate = RTCIceCandidate(
        component=int(bits[1]),
        foundation=bits[0],
        ip=bits[4],
        port=int(bits[5]),
        priority=int(bits[3]),
        protocol=bits[2],
        type=bits[7],
    )

I have the candidate arguments in a different order than expected: sdp content: 1 udp 2113939711 2607:f8b0:400e:c0a::7f 19305 typ host generation 0 so the bits array contains: ['1', 'udp', '2113939711', '2607:f8b0:400e:c0a::7f', '19305', 'typ', 'host', 'generation', '0']

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
juberticommented, Jan 25, 2022

I’d actually suggest filing a bug at bugs.webrtc.org about this, Chrome really ought not to do this. I can route it to the right people once filed.

0reactions
danieleratticommented, Nov 23, 2021

I managed to get this Nest stream working. In case, I’ve created the pull request #590 if you want to add this more relaxed version of the protocol in this project considering Google Chrome is accepting it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to start WebRTC stream: Nest API error: Error ... - GitHub
The problem I just managed to add google nest to HA. My Nest Learning Thermostat is working fine. But my Nest doorbell is...
Read more >
CameraLiveStream - Device Access | Google Developers
Token to use to invalidate an existing RTSP live stream. string. Example: "CjY5Y3VKaTZwR3o4Y19YbTVfMF..." GenerateWebRtcStream. Nest Cam ( ...
Read more >
Getting INVALID_ARGUMENT error on Nest Battery Cam ...
The following code generates a correct SDP offer which is accepted by Google. const myPeerConnection = new RTCPeerConnection myPeerConnection.
Read more >
Realtime camera streaming without any delay - WebRTC
I'm now getting an error: “ERROR: WebRTC server not available”, after some time it tries to restart the stream and it get's the...
Read more >
INVALID_ARGUMENT error on GenerateWebRtcStream ...
... command on a Nest Battery Cam which only support WebRTC streams… ... error on GenerateWebRtcStream command (Nest Battery Cam).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found