stasel / WebRTC

Unofficial distribution of up to date WebRTC framework binaries for iOS and macOS
Other
359 stars 76 forks source link

h264 in incoming sdp faol to set remote video description #32

Closed wmasilva closed 2 years ago

wmasilva commented 2 years ago

hi, I'm using your repository to build a ios webrtc app and connect with freeswitch mod_verto, everything works great (audio and video calls with vp8) except for incoming calls with codec h264 in the invite i got the following error:

"Failed to set remote video description send parameters for m-section with mid='1' "

The received SDP:

v=0
o=FreeSWITCH 1647442427 1647442428 IN IP4 192.168.10.1
s=FreeSWITCH
c=IN IP4 192.168.10.1
t=0 0
a=msid-semantic: WMS L76yjFgAt4mYXs69IVG853RNRIrttj84
m=audio 10070 RTP/SAVPF 0 8 102 9
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; cbr=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40
a=rtpmap:9 G722/8000
a=fingerprint:sha-256 35:47:ED:5C:EE:2F:BC:0F:6B:D0:56:DA:86:B8:C7:80:0B:97:02:51:3B:B3:BC:08:26:2D:80:DB:4B:F2:7B:08
a=setup:actpass
a=rtcp-mux
a=rtcp:10070 IN IP4 192.168.10.1
a=ssrc:1049788873 cname:g5tqAzRUu3JimFhV
a=ssrc:1049788873 msid:L76yjFgAt4mYXs69IVG853RNRIrttj84 a0
a=ssrc:1049788873 mslabel:L76yjFgAt4mYXs69IVG853RNRIrttj84
a=ssrc:1049788873 label:L76yjFgAt4mYXs69IVG853RNRIrttj84a0
a=ice-ufrag:qOTlHBZp9gIsqHnw
a=ice-pwd:CGN36uNqomyBRGm8k6jSx97w
a=candidate:3360592939 1 udp 2130706431 192.168.10.1 10070 typ host generation 0
a=candidate:3360592939 2 udp 2130706431 192.168.10.1 10070 typ host generation 0
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
m=video 10072 RTP/SAVPF 103
a=rtpmap:103 H264/90000
a=fmtp:103 profile-level-id=640c1f
a=sendrecv
a=fingerprint:sha-256 35:47:ED:5C:EE:2F:BC:0F:6B:D0:56:DA:86:B8:C7:80:0B:97:02:51:3B:B3:BC:08:26:2D:80:DB:4B:F2:7B:08
a=setup:actpass
a=rtcp-mux
a=rtcp:10072 IN IP4 192.168.10.1
a=rtcp-fb:103 ccm fir
a=rtcp-fb:103 ccm tmmbr
a=rtcp-fb:103 nack
a=rtcp-fb:103 nack pli
a=ssrc:226084376 cname:g5tqAzRUu3JimFhV
a=ssrc:226084376 msid:L76yjFgAt4mYXs69IVG853RNRIrttj84 v0
a=ssrc:226084376 mslabel:L76yjFgAt4mYXs69IVG853RNRIrttj84
a=ssrc:226084376 label:L76yjFgAt4mYXs69IVG853RNRIrttj84v0
a=ice-ufrag:K0Dr2dnhdKdIj7oO
a=ice-pwd:cNHf9Vo2PUYA8qJIhc0agdhj
a=candidate:2575442282 1 udp 2130706431 192.168.10.1 10072 typ host generation 0
a=candidate:2575442282 2 udp 2130706430 192.168.10.1 10072 typ host generation 0
a=end-of-candidates

I could' think that h264 was not supported... but for outgoing calls it works ok and i have h264 both ways, the sdp generated in the device is:


v=0
o=- 7773074587810951361 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=extmap-allow-mixed
a=msid-semantic: WMS stream
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 102 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:BOEf
a=ice-pwd:0vSMJJx/JsQtAQ216aD1DM2Q
a=ice-options:trickle renomination
a=fingerprint:sha-256 70:F1:18:56:E9:CD:09:CA:E6:25:06:98:60:4F:98:B4:0C:A0:A4:07:82:22:73:0E:22:26:1E:8D:15:A3:EC:2E
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:stream audio0
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:102 ILBC/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:1128105847 cname:CpXfrIKQ8/xdoTeC
a=ssrc:1128105847 msid:stream audio0
a=ssrc:1128105847 mslabel:stream
a=ssrc:1128105847 label:audio0
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 124 35 36 123 122 125
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:BOEf
a=ice-pwd:0vSMJJx/JsQtAQ216aD1DM2Q
a=ice-options:trickle renomination
a=fingerprint:sha-256 70:F1:18:56:E9:CD:09:CA:E6:25:06:98:60:4F:98:B4:0C:A0:A4:07:82:22:73:0E:22:26:1E:8D:15:A3:EC:2E
a=setup:actpass
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:stream video0
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 H264/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 H264/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP8/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:127 VP9/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=rtpmap:124 rtx/90000
a=fmtp:124 apt=127
a=rtpmap:35 AV1/90000
a=rtcp-fb:35 goog-remb
a=rtcp-fb:35 transport-cc
a=rtcp-fb:35 ccm fir
a=rtcp-fb:35 nack
a=rtcp-fb:35 nack pli
a=rtpmap:36 rtx/90000
a=fmtp:36 apt=35
a=rtpmap:123 red/90000
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=123
a=rtpmap:125 ulpfec/90000
a=ssrc-group:FID 510134134 3309272499
a=ssrc:510134134 cname:CpXfrIKQ8/xdoTeC
a=ssrc:510134134 msid:stream video0
a=ssrc:510134134 mslabel:stream
a=ssrc:510134134 label:video0
a=ssrc:3309272499 cname:CpXfrIKQ8/xdoTeC
a=ssrc:3309272499 msid:stream video0
a=ssrc:3309272499 mslabel:stream
a=ssrc:3309272499 label:video0

Do you know if there is any option to process the incoming sdp?

Edited:

i checked in the webrtcClient the supported for video codecs:


 let defaultRTC = RTCDefaultVideoDecoderFactory()
  let defaultEncodeRTC = RTCDefaultVideoEncoderFactory()
  for codec in defaultRTC.supportedCodecs() {
      print("defaultRTC -> \(codec.name) => \(codec.parameters)")
  }

  for codec in defaultEncodeRTC.supportedCodecs() {
      print("defaultEncodeRTC -> \(codec.name) => \(codec.parameters)")
   }

and h264 is supported:

defaultRTC -> H264 => ["packetization-mode": "1", "profile-level-id": "640c1f", "level-asymmetry-allowed": "1"]
defaultRTC -> H264 => ["packetization-mode": "1", "profile-level-id": "42e01f", "level-asymmetry-allowed": "1"]
defaultRTC -> VP8 => [:]
defaultRTC -> VP9 => [:]
defaultRTC -> AV1 => [:]
defaultEncodeRTC -> H264 => ["packetization-mode": "1", "profile-level-id": "640c1f", "level-asymmetry-allowed": "1"]
defaultEncodeRTC -> H264 => ["packetization-mode": "1", "profile-level-id": "42e01f", "level-asymmetry-allowed": "1"]
defaultEncodeRTC -> VP8 => [:]
defaultEncodeRTC -> VP9 => [:]
defaultEncodeRTC -> AV1 => [:]

Thanks, António

wmasilva commented 2 years ago

got it, is necessary to send the fmtp for the h264 codec, i my case solve it by setting:

a=fmtp:103 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f

Sorry.