public static bool HardwareCodecSupport() { if (!WebRTC.HardwareEncoderSupport()) { return(false); } WebRTC.Initialize(EncoderType.Hardware); var isSupported = CheckVideoCodecCapabilities(); WebRTC.Dispose(); return(isSupported); }
private void Start() { trackInfos = new StringBuilder(); pc1Senders = new List <RTCRtpSender>(); callButton.interactable = true; pc1OnIceConnectionChange = state => { OnIceConnectionChange(_pc1, state); }; pc2OnIceConnectionChange = state => { OnIceConnectionChange(_pc2, state); }; pc1OnIceCandidate = candidate => { OnIceCandidate(_pc1, candidate); }; pc2OnIceCandidate = candidate => { OnIceCandidate(_pc2, candidate); }; pc2Ontrack = e => { OnTrack(_pc2, e); }; pc1OnNegotiationNeeded = () => { StartCoroutine(PcOnNegotiationNeeded(_pc1)); }; infoText.text = !WebRTC.HardwareEncoderSupport() ? "Current GPU doesn't support encoder" : "Current GPU supports encoder"; }
static void OnLoad() { var ignoreHardwareEncoderTest = !WebRTC.HardwareEncoderSupport(); ConditionalIgnoreAttribute.AddConditionalIgnoreMapping(UnsupportedHardwareForHardwareCodec, ignoreHardwareEncoderTest); var ignoreReceiveVideoTest = !TestHelper.CheckVideoSendRecvCodecSupport(EncoderType.Hardware); ConditionalIgnoreAttribute.AddConditionalIgnoreMapping(UnsupportedReceiveVideoOnHardware, ignoreReceiveVideoTest); #if !UNITY_2020_1_OR_NEWER ConditionalIgnoreAttribute.AddConditionalIgnoreMapping(UnsupportedPlatformVideoDecoder, SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12); #endif }
public static bool CheckVideoSendRecvCodecSupport(EncoderType encoderType) { // hardware encoder is not supported if (encoderType == EncoderType.Hardware && !WebRTC.HardwareEncoderSupport()) { return(false); } WebRTC.Initialize(encoderType); var capabilitiesSenderCodec = RTCRtpSender.GetCapabilities(TrackKind.Video) .codecs .Select(x => x.mimeType) .Except(excludeCodecMimeType); var capabilitiesReceiverCodec = RTCRtpReceiver.GetCapabilities(TrackKind.Video) .codecs .Select(x => x.mimeType) .Except(excludeCodecMimeType); var isSupported = capabilitiesSenderCodec.Any(x => capabilitiesReceiverCodec.Contains(x)); WebRTC.Dispose(); return(isSupported); }