awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
66 stars 29 forks source link

How to support the H264 which the profile-level-id is 42e01f #29

Closed HiLittlePiper closed 3 years ago

HiLittlePiper commented 3 years ago

Hi,

because the target embedded camera only support H264 which the profile-level-id is 42e01f, iOS app also want to support this kind of H264, but from the iOS WebRTC SDK, it only support H264 which profile-level-id are 640c2a and 42e02a. it will lead the video cannot be decoded successfully. I also try to customize the profile-level-id with 42e01f and forbid other profile-level-id, however, the video cannot be rendered any more. Could you please point out how to support this kind of H264 format? appreciate for help.

thanks

HiLittlePiper commented 3 years ago

Could someone please provide some suggestion for this?

disa6302 commented 3 years ago

@HiLittlePiper ,

Can you mention how you customized the profile level on iOS?

HiLittlePiper commented 3 years ago

@disa6302

I created new classes to inherit RTCDefaultVideoEncoderFactory and RTCDefaultVideoDecoderFactory, and rewrote the supportedCodecs() function, then created the RTCPeerConnectionFactory object with them. Maybe I missed something, please kindly advise this. Thanks.


1). customized the profile class RTCCustomVideoEncoderFactory: RTCDefaultVideoEncoderFactory { override func supportedCodecs() -> [RTCVideoCodecInfo] { var infos = super.supportedCodecs()

    let constrainedHighParams: [String : String] = [
        "profile-level-id": "42e01f",
        "level-asymmetry-allowed": "1",
        "packetization-mode": "1"
    ]

    let rvc = RTCVideoCodecInfo(name: "H264", parameters: constrainedHighParams)

    infos.append(rvc)

    return [rvc]

}

}

class RTCCustomVideoDecoderFactory: RTCDefaultVideoDecoderFactory { override func supportedCodecs() -> [RTCVideoCodecInfo] { var infos = super.supportedCodecs()

    let constrainedHighParams: [String : String] = [
        "profile-level-id": "42e01f",
        "level-asymmetry-allowed": "1",
        "packetization-mode": "1"
    ]

    let rvc = RTCVideoCodecInfo(name: "H264", parameters: constrainedHighParams)

    infos.append(rvc)

    return [rvc]

}

}

2) create RTCPeerConnectionFactory RTCPeerConnectionFactory(encoderFactory: RTCCustomVideoEncoderFactory(), decoderFactory: RTCCustomVideoDecoderFactory())

disa6302 commented 3 years ago

@HiLittlePiper ,

I am not familiar with the WebRTC implementation for iOS. So I am unable to give a suggestion about your piece of right away. However, to see if the profile with 42e01f is being generated, I would suggest you to look at the offer and the answer to see how the media lines look. Confirm if the SDP from the iOS device contains the 42e01f profile.

Also, to confirm, is the other peer running the C SDK?

HiLittlePiper commented 3 years ago

@disa6302

After customized the 42e01f profile, from the log I caught, I found this kind of profile is contained in the offer and answer.

Yes, the Master is embedded camera running the C SDK, and iOS app as Viewer will connect it.

disa6302 commented 3 years ago

@HiLittlePiper ,

If I understand correctly, it looks like the C SDK is unable to decode the stream. I would like to check the C SDK logs to see if it catches anything. Can you attach the logs and also attach the SDP? On the C SDK end, you can run export DEBUG_LOG_SDP=TRUE to capture the SDPs in the logs.

disa6302 commented 3 years ago

@HiLittlePiper ,

If this issue is opened by your team in https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/issues/1033, I would suggest to close this out to continue discussions in the C SDK issue.

MushMal commented 3 years ago

Closing this in favor of https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/issues/1033