Kaspars Michulis
Kaspars Michulis

Reputation: 61

Understanding how to generate correct sdp for offer/answer (webrtc) between android/Iphone

I am struggling to understand the correct way to make correct offer answer when signaling is between Iphone and android phone. Because of different codecs Iphone setRemoteDescription is failing. As known android does not accept H264.

(Failed to set remote video description send parameters)

Between android/android all working fine because both phones have equal VP8/9 codecs. But in my case IOS is sending to android sdp offer with ONLY H264 codec. So appearently that is the problem. Despite that android is setting remotedescription and afterher creates answer with sdp without VP8/9 codec info. This answer sdp is setting Iphone with above mentioned error. So i am asking why in android answer sdp is no line with VP8/9 or any codec. You can see offers and answer sdps in this question ( offer and answer sdp). So i try to init PeerconnectionFactory following way

    let decoderFactory = RTCDefaultVideoDecoderFactory.init()
    let encoderFactory = RTCDefaultVideoEncoderFactory.init()
    let videoCodedInfo = RTCVideoCodecInfo.init(name: kRTCVideoCodecVp8Name )
    encoderFactory.preferredCodec = videoCodedInfo        
    let connectionFactory = RTCPeerConnectionFactory.init(encoderFactory: encoderFactory, decoderFactory: decoderFactory)

But even i use such initialization sdp offers and answers does not changes. So where is the problem and how i can create correct sdp for android/Ios so the setremotedescription does not show error.

I have android app using libjingle from 2015 and for IOS app GoogleWebRTC pod from 2018.

Upvotes: 4

Views: 2304

Answers (2)

walktime
walktime

Reputation: 1

I think it is the google-webrtc version problem. but i don't know why. you should not use the 'org.webrtc:google-webrtc:1.0.+'. you can try a proper version, like 'org.webrtc:google-webrtc:1.0.24277'

Upvotes: 0

You can try

let decoderFactory = RTCDefaultVideoDecoderFactory()
let encoderFactory = RTCDefaultVideoEncoderFactory()
factory = RTCPeerConnectionFactory(encoderFactory: encoderFactory, decoderFactory: decoderFactory)

I use https://cocoapods.org/pods/GoogleWebRTC in IOS. This worked for me when call with Android 4.x, video type is VP8 and when call with IOS video is H264. Hope for you

Upvotes: 0

Related Questions